【发布时间】:2015-09-21 06:29:08
【问题描述】:
成功安装 CakePHP 后,在第一次运行时,我在底部收到这些警告。我该如何解决这个问题。
警告 (2):View::element() 缺少参数 1,在第 61 行的 /Users/michaelanywar/Sites/cakephp/app/View/Layouts/default.ctp 中调用并定义了 [CORE/Cake/View /View.php,第 398 行]
注意(8):未定义变量:名称[CORE/Cake/View/View.php,第416行]
注意(8):未定义变量:名称[CORE/Cake/View/View.php,第422行]
通知 (1024):未找到元素:Elements/.ctp [CORE/Cake/View/View.php,第 425 行]
我的 View/view.php 行从 398 到 427 如下所示:
public function element($name, $data = array(), $options = array()) {
$file = $plugin = null;
if (isset($options['plugin'])) {
$name = Inflector::camelize($options['plugin']) . '.' . $name;
}
if (!isset($options['callbacks'])) {
$options['callbacks'] = false;
}
if (isset($options['cache'])) {
$contents = $this->_elementCache($name, $data, $options);
if ($contents !== false) {
return $contents;
}
}
$file = $this->_getElementFilename($name);
if ($file) {
return $this->_renderElement($file, $data, $options);
}
if (empty($options['ignoreMissing'])) {
list ($plugin, $name) = pluginSplit($name, true);
$name = str_replace('/', DS, $name);
$file = $plugin . 'Elements' . DS . $name . $this->ext;
trigger_error(__d('cake_dev', 'Element Not Found: %s', $file), E_USER_NOTICE);
}
}
【问题讨论】: