我第一次 看网上写的代码:
- define('THINK_PATH','ThinkPHP');
- define('App_NAME','43');
- define('App_PATH','.');
- require(THINK_PATH.'/ThinkPHP.php');
- $App=new App();
- $App->run();(这一行 可以不要 要不然结果会出现两次)
- ?>
报告出错:
Warning: require(../ThinkPHPCommon/runtime.php) [function.require]: failed to open stream: No such file or directory in D:webhtdocsThinkPHPThinkPHP.php on line 36
Fatal error: require() [function.require]: Failed opening required '../ThinkPHPCommon/runtime.php' (include_path='.;C:php5pear') in D:webhtdocsThinkPHPThinkPHP.php on line 36
查资料看到:
关于常量 THINK_PATH 的定义:
ThinkPHP 2.x
define('THINK_PATH', '../ThinkPHP');
ThinkPHP 3.x
define('THINK_PATH', '../ThinkPHP/');
当然你可以不去定义它,ThinkPHP 真的很奇怪,这样重大的改变都不声明一下,难道不打算让人家用它了?
后来还是不行,看来变天才知道 define('THINK_PATH','ThinkPHP'); 少写了一个/ define('THINK_PATH','ThinkPHP/'); 这样就对了.