1、strpos
Find the numeric position of the first occurrence of needle
in the haystack
string.
查找$needle在字符串$haystack中出现的位置。特别注意可能返回位置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()
<?php
echo str_replace("world","Shanghai","Hello world!");
?>
// Hello Shanghai!
4 dirname()
函数返回路径中的目录部分。
<?php
echo dirname("c:/testweb/home.php");
echo dirname("/testweb/home.php");
?>
//
c:/testweb /testweb
5 string getcwd ( void )
获得当前的工作目录
6
substr() 函数返回字符串的一部分。
注释:如果 start 参数是负数且 length 小于或等于 start,则 length 为 0。