几个入口文件定义函数

define('THINK_START_TIME', microtime(true));
define('THINK_START_MEM', memory_get_usage());
define('EXT', '.php');
define('DS', DIRECTORY_SEPARATOR);
defined('THINK_PATH') or define('THINK_PATH', __DIR__ . DS);
define('LIB_PATH', THINK_PATH . 'library' . DS);
define('CORE_PATH', LIB_PATH . 'think' . DS);
define('TRAIT_PATH', LIB_PATH . 'traits' . DS);
defined('APP_PATH') or define('APP_PATH', dirname($_SERVER['SCRIPT_FILENAME']) . DS);
//                     // echo    APP_PATH;//C:\Program Files (x86)\Zend\Apache2\htdocs\PT5_Core\public/../application/
//                     ECHO $_SERVER['SCRIPT_FILENAME'];//C:/Program Files (x86)/Zend/Apache2/htdocs/PT5_Core/public/index.php
//                     ECHO "<HR/>";
//                     ECHO dirname($_SERVER['SCRIPT_FILENAME']);//  C:/Program Files (x86)/Zend/Apache2/htdocs/PT5_Core/public
//                     ECHO "<HR/>";
//                     ECHO "<PRE>";
//                     VAR_DUMP( $_SERVER);
//                     ECHO "</PRE>";
//                     // PRINT_R($_SERVER);

defined('ROOT_PATH') or define('ROOT_PATH', dirname(realpath(APP_PATH)) . DS);
echo APP_PATH;//C:\Program Files (x86)\Zend\Apache2\htdocs\PT5_Core\public/../application/
ECHO "<BR/>";
echo realpath(APP_PATH);//C:\Program Files (x86)\Zend\Apache2\htdocs\PT5_Core\application

//realpath() 函数返回绝对路径。

//该函数删除所有符号连接(比如 '/./', '/../' 以及多余的 '/'),返回绝对路径名。

//若失败,则返回 false。比如说文件不存在的话。


ECHO "<BR/>";
echo dirname(realpath(APP_PATH));// C:\Program Files (x86)\Zend\Apache2\htdocs\PT5_Core
ECHO "<BR/>";
ECHO dirname(dirname(realpath(APP_PATH)));//C:\Program Files (x86)\Zend\Apache2\htdocs

posted @ 2017-01-17 15:04  Hmetoer  阅读(296)  评论(0编辑  收藏  举报