我已在同一目錄這兩個PHP文件:PHP不能導入類文件
的index.php
<?php
echo "before";
require('Parser.php');
echo "after";
?>
Parser.php
<?php
/**
* Class Parser
*/
class Parser
{
private $url;
function __construct($url)
{
$this->url = $url;
}
public function getUrl(){
return $this->url;
}
public functionsetUrl($url){
$this->url = $url;
}
}
?>
我需要導入解析器文件,因爲我必須在我的索引文件中使用這個類,但我不能。
導入此類時出現問題,因爲如果我嘗試訪問index.php,我只能看到第一個打印:before
。
我不知道問題出在哪裏,但很奇怪,我的文件很簡單。
我的php版本是5.6,我使用MAMP作爲web服務器。
有人可以幫助我嗎? 感謝
打開錯誤。你可能有一個'致命錯誤' – Rasclatt 2014-11-04 22:00:50