有人能看到为什么我的check_multi函数将返回 -不能模型内访问功能ZEND
Fatal error: Call to undefined function check_multi() in /var/www/vhosts/aero.onelinksoftware.com/application/models/Design.php on line 21
上述错误显示出来,我不知道我做错了。我尝试将我的功能设置为公共,私人,静态和其他组合,但不管我尝试什么;系统仍然出错。你不能在Zend中的Model中调用函数吗?我不明白为什么我不能使用我创建的函数,如果它在我创建的类中。
如果我在check_multi调用之前回声并死亡;我可以看到我的文字等。我还执行了语法的php测试,并且只要报告它就是有效的。
class Model_Design
{
/**
* Constructs our partials.
*
* @return void
*/
public function __construct($key)
{
// Get the DB Connection
$db = Zend_Registry::Get('db');
// Setup the SQL Statement
$sql = $db->select()->from('design', array('id'));
// Get the Result
$result = $sql->query();
// Get our Row
$row = $result->fetchAll();
if(check_multi($key, $row)) {
echo "omg"; die();
}
// Make sure the id isn't empty
if (empty($key)) {
throw new Exception('You have a disturbing lack of variables.');
}
// Store the id
$this->variables = $key;
// Construct our query
$sql = $db->select()->from('design')->where('`id` = ?', $key);
// Get the result
//$result = $sql->query();
//$row = $result->fetch();
}
private function check_multi($n, $arr)
{
foreach ($arr as $key => $val) {
if ($n===$key) {
return $key;
}
}
return false;
}
}
这很好。谢谢!我正在拉我的头发。 – ILikeTurtles