201710 PHP 函数回顾
来源:互联网 发布:spss for mac安装教程 编辑:程序博客网 时间:2024/06/05 22:35
1、strpos
basename() 函数返回路径中的文件名部分。
//Hello Shanghai!
5string getcwd ( void )
mixed strpos ( string
$haystack
, mixed $needle
[, int $offset
= 0 ] )Find the numeric position of the first occurrence of needle
in the haystack
string.
特别注意可能返回位置0以及查找不到的时候返回false,所以比较的时候注意要用===或者!==
$offset代表偏移量,例如下面的例子,返回值是7而不是0
<?php// We can search for the character, ignoring anything before the offset$newstring = 'abcdef abcdef';$pos = strpos($newstring, 'a', 1); // $pos = 7, not 0?>2、
basename(__FILE__)
basename() 函数返回路径中的文件名部分。
详细用法再研究
3 str_replace()
<?phpecho str_replace("world","Shanghai","Hello world!");?>
//Hello Shanghai!
4 dirname()
函数返回路径中的目录部分。
<?phpecho dirname("c:/testweb/home.php");echo dirname("/testweb/home.php");?>//
c:/testweb/testweb
5string getcwd ( void )
获得当前的工作目录
6
substr() 函数返回字符串的一部分。
注释:如果 start 参数是负数且 length 小于或等于 start,则 length 为 0。
阅读全文
0 0
- 201710 PHP 函数回顾
- PHP基础知识点简单回顾:变量、函数以及PHP基本格式
- PHP 2007 回顾
- php/回顾1
- php/回顾2
- PHP回顾3
- [php]架构模式回顾
- php基础知识回顾
- php class回顾篇
- PHP基础回顾
- PHP基础知识回顾一
- php基础回顾
- 回顾虚函数表
- 仿函数的回顾
- c语言回顾--函数
- 回顾一些小函数
- 第一章 PHP概述 (重点回顾)
- 回顾php与html测试
- distinct-subsequences Java code
- MAVEN
- 关于强连通分量
- myeclipse中为什么elasticsearch5.X后client类没有方法
- learning R with lapply and sapply(不懂)
- 201710 PHP 函数回顾
- C# Winform中实现主窗口打开登录窗口关闭的方法
- 前端纯js对表格进行快速排序,统计
- Ros图像与Opencv图像的相互转换(C++)
- 从银行转账失败到分布式事务:总结与思考
- Android简易实战教程--第五十四话《视差特效》
- ngrok使用
- 基于TCP协议的socket通信
- SELECT INTO FROM和INSERT INTO SELECT ,CREATE TABLE 表名(SELECT)