如何在zend框架上添加jquery脚本


how to add jquery script on zend framework

我想在zendframework项目上添加jquery脚本,这是我的布局。html页眉部分

<?php 
$this->headMeta()->appendHttpEquiv(
'Content-Type', 'text/html;charset=utf-8');
$this->headTitle('ToDo APP')->setSeparator(' - ');
 echo $this->doctype(); ?>  
 <html xmlns="http://www.w3.org/1999/xhtml"> 
 <head>
 <?php echo $this->headMeta(); ?> 
 <?php echo $this->headLink()->appendStylesheet($this->baseUrl().'/css/style.css'); ?>
 <?php print $this->headScript()->appendFile($this->baseUrl().'/js/bootstrap.js')
 ->prependFile('http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js'); ?>
 </head>

我需要http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js让我能够使用我的引导。Js文件,但它不工作,请帮助如何正确地做到这一点我的CSS和js文件夹也放在公共文件夹

method-1

为什么不像

那样直接将它包含在<head>中呢?
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

方法2
下载这个jquery文件并保存在你的js文件夹中,名称为jquery.min.js

现在像包含bootstrap.js一样包含它

<?php print $this->headScript()->appendFile($this->baseUrl().'/js/jquery.min.js'); ?>

就像这样嵌入到你的html中

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>