PHP包含不起作用

时间:2015-11-20 17:41:44

标签: php include

我刚刚签署了一个Web应用程序来开发。从Github中提取代码之后,我一直在努力让它在我的本地开发设置上运行。有一个问题。名为“signup_action.php”的文件就像这样开始:

 <?php

ini_set('display_errors', true);
error_reporting(E_ALL | E_STRICT);

echo getcwd() . "<br>"; //for testing
echo getcwd() . "/code/includes.php" . "<br>"; //for testing

include("./code/includes.php");
//include(getcwd() . "/code/includes.php");

echo("Hello from point 3 <br>"); //for testing
...

然后,如果我转到code / includes.php的开头,我有以下内容:

<?php

echo "Hello from point 1 of code/includes.php" . "<br>";

include_once("local_config.php");
//ini_set("memory_limit", "128M");

date_default_timezone_set("EST");

浏览器中signup_action.php的输出是:

  

/用户/ genericuser /网络/位点/ PROJECT1

     

/Users/genericuser/www/sites/project1/code/includes.php

为什么我没有看到includes.php的任何“echo”输出?在我发现signup_action.php没有执行其功能并给我一个空白页面后,我开始对此进行故障排除。 include()有效吗?

1 个答案:

答案 0 :(得分:-1)

include_once和date_default_timezone应该在其他PHP代码操作之前解决。

include_once( “local_config.php”); // ini_set(“memory_limit”,“128M”);

date_default_timezone_set( “EST”);

echo“代码/ includes.php的第1点的Hello”。 “
”;