2012-02-06 33 views
-1

我在我的default.ctp(projects/customer/lib/Cake/View/Layouts/default.ctp)頭標記中有以下代碼:無法鏈接JavaScript中的蛋糕php(defalut.ctp)

<script type="text/javascript" src="/home/developer/workarea/projects/customer/app/webroot/js/jquery.autoSuggest.packed.js"></script> 

但JS文件不可用的瀏覽器:點擊查看源代碼的鏈接,查看js文件產生以下錯誤:

<title>404 Not Found</title> 
</head><body> 
<h1>Not Found</h1> 
<p>The requested URL /home/developer/workarea/projects/customer/app/webroot/js/jquery.autoSuggest.packed.js was not found on this server.</p> 
<hr> 
<address>Apache/2.2.14 (Ubuntu) Server at localhost Port 80</address> 
</body></html> 

但js文件是訪問通過直接輸入網址在瀏覽器中。

+0

'/家庭/開發商/工作區/項目/客戶/應用/ Webroot公司/ JS/jquery.autoSuggest.packed.js'是它的根目錄的路徑文件系統還是從Web服務器的根目錄? – Cheery 2012-02-06 06:22:29

+0

@cheery其從Web服務器即文件夾WWW => – 2012-02-06 06:37:12

+0

你是自相矛盾的項目根目錄的路徑。如果'projects'是WWW服務器的根,那麼爲什麼你寫的'/家庭/開發商/ workarea'?在編程 – Cheery 2012-02-06 06:39:57

回答

0

爲什麼你don'try:

<?php $this->Html->script('jquery.autoSuggest.packed.js');?>