加载php文件后,我的HTML源为空。
有人能告诉我为什么我在用file_get_contents声明私有变量时会出现这个错误吗?
class Main {
private $order = file_get_contents("file.ini");
...
...
...
}
我使用的是PHP 5.3.28,是的allow_url_fopen=在上
谢谢!
class Main {
private $order;
public function __construct(){
$this->order = file_get_contents("file.ini");
}
}
我希望这将对您有所帮助:
class Main {
private $order;
public function __construct($path) {
$this->order = file_get_contents($path);
}
public function getOrder() {
return $this->order;
}
public function setOrder($path) {
$this->order = file_get_contents($path);
}
}
祝你好运!