我需要在我的Zend Framework项目中添加jQuery和其他JavaScript文件。我尝试使用Action controller来完成:
public function userinfoAction()
{
$this->view->headScript()->appendFile($basePath .'/js/validate_jquary.js');
$this->headScript()->appendFile('http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js');
return new ViewModel();
}
但它没有起作用。
$this->headScript()
进行回显?此外,您的操作中有一个返回语句似乎不正确,尽管我不熟悉ZF2,所以它可能是有效的。 - vascowhite$this->headScript()
。 - Mangala Edirisinghe