-2
在這裏,我將我的代碼代碼運行在PHP 5.3.6,但不運行5.1.6
class1.php
<?php
class class1
{
public function test_class(){
return "text_class";
}
}
?>
class2.php
<?php
require_once "class1.php";
class class2{
public function __construct(){
$this->classs=new class1();
}
public function test_class2(){
echo $this->classs->test_class();
return "text_class";
}
}
?>
運行class2.php時執行停止在class2.php contructor.no錯誤或警告不顯示。
我使用的PHP版本5.1.6
使用錯誤報告http://php.net/manual/en/function.error-reporting.php如果您的系統沒有設置捕獲和默認顯示錯誤。 –
我包括類error_reporting(E_ALL)但不工作的頂部 – sridhard
請參閱下面給出的答案然後 –