總之..問題是......「說什麼?」擴展名爲「我沒有收到錯誤」幫助理解PHP5錯誤
嚴格標準:非靜態方法Pyro \ Template :: preLoad()不應該靜態調用,假設$ this來自/ opt中的不兼容上下文在線/lampp/htdocs/dc/pyro/app/controllers/admin/courses.php 14
public function actionIndex() {
$this->data->users = $this->DB->query("SELECT id, name, description FROM :@courses")->getAll();
$this->data->title = 'Courses';
$this->data->content_area = \Pyro\Template::preLoad('admin/courses/index', $this->data); // Line 14
}
模板...它不完全...
<?php
namespace Pyro;
class Template {
// Stores default master template
public static $defaultTemplate = 'template.php';
public function preLoad($template, $page) {
ob_start();
include(VIEWS . "{$template}.php");
$buffer = ob_get_contents();
@ob_end_clean();
return $buffer;
}
public function load($page) {
include(VIEWS . self::$defaultTemplate);
}
}
爲什麼這個錯誤出現?乾杯
+1提供了一個很好的解釋+替代解決方案 – Capsule 2011-03-01 16:09:01