我使用zend框架顺便说一句,我已经实现了ZendX_JQuery_Form_Element_AutoComplete。它在我的本地系统上按预期工作,但在实时服务器上,当我开始输入时,它会给我一个500内部服务器错误。我已经有3天这个问题了,而且我已经使用Google并阅读了很少的解决方案。500服务器上的内部服务器错误,但在开发系统上工作
希望有人能帮忙。
服务器和开发系统都运行Ubuntu,我试图在两个系统上保持相同的设置。
编辑:
我检查了链接和许可的建议和问题仍然存在。所以我所做的就是从字面上运行的代码行由行,我来到了以下行触发错误500控制器:
$response = $groupsmapper->search($this->getRequest()->getParam('term'));
下面
是完整的功能
public function getallgroupnamesAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->getHelper('layout')->disableLayout();
$groupsmapper = new Application_Model_GroupsMapper();
$response = $groupsmapper->search($this->getRequest()->getParam('term'));
$json = Zend_Json::encode(array_values($response));
echo $json;
}
和groupsmapper的搜索方法是像这样
public static function search($term)
{
$groupsmapper = new Application_Model_GroupsMapper();
$response = $groupsmapper->getDbTable()->fetchAll(
$groupsmapper->getDbTable()
->select()
->distinct()
->from(array('groups'), array('group_name'))
);
$no_groups = count($groups_array = $response->toArray());
for ($x = 0; $x < $no_groups; $x++)
{
$groups[] = $groups_array[$x]['group_name'];
}
$filter = function($group) use ($term)
{
if(stristr($group, $term))
return true;
return false;
};
return array_filter($groups, $filter);
}
我真的希望你们能发现什么,其他明智的方案是使用select元素,但该列表将过长或让用户输入名称并单击提交按钮进行搜索。这也不是很理想,因为拼写不常见或不容易找出,因此查询可能不总是锻炼。
错误日志实际上对错误消息的详细信息说了什么?没有更多的细节,这是不可能的。 – artlung 2011-01-06 15:00:42