define(‘S_ROOT’, substr(dirname(__FILE__), 0, -3));


此语句包含:
1.define()
2.substr()
3.dirname()
4._FILE_
———————————————–
1.define(‘A’,B );

将B赋给A。
如果写成@define() ,语句前面添加符号@的功能是:如果这个语句出现错误,错误信息不显示在网页上。
2.substr(string,start,length);

取字符串的一部分。其中,

start

正数 – 在字符串的指定位置开始

负数 – 在从字符串结尾的指定位置开始

0 – 在字符串中的第一个字符处开始

length:

正数 – 从 start 参数所在的位置返回

负数 – 从字符串末尾减去该数值的字符返回

例如

substr(“Hello World”,0,3);

得到:Hel

substrate(”Hello World”,0,-3);

得到:Hello Wo

3.dirname()
返回路径中的目录部分.给出一个包含有指向一个文件的全路径的字符串,本函数返回去掉文件名后的目录名。

4._FILE_
返回_FILE_所在文件的完整路径。
例如:_FILE_在test.php中,而test.php在C:\wamp\www\目录下。那么__FILE__ 返回的就是C:\wamp\www\test.php。

No Comments.

Leave a Reply

(required)

(required)

:alien: :angel: :angry: :blink: :blush: :cheerful: :cool: :cwy: :devil: :dizzy: :ermm: :face: :getlost: :biggrin: :happy: :heart: :kissing: :lol: :ninja: :pinch: :pouty: :sad: :shocked: :sick: :sideways: :silly: :sleeping: :smile: :tongue: :unsure: :w00t: :wassat: :whistle: :wink: :wub: