开发者

dir manipulation(__DIR__) not working

the following behaves different in host:

echo 'DIR:' .__DIR__; // DIR:__DIR__

localhost:(works fine):

开发者_如何学Python
DIR:C:\Program Files\VertrigoServ\www

why this different output?


You need PHP 5.3 to use __DIR__

Manual page

On previous versions you may use dirname(__FILE__) instead


According to the PHP magic constants docs, the __DIR__ constant was added only in php 5.3.0. You're probably using an older version in your "host" environment.


Try:

<? echo realpath(dirname(__DIR__)); ?>

Folder: localhost or root :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜