0
当试图从Web根目录访问JavaScript文件,我得到以下错误:无法找到CakePHP JsController。
Missing Controller
Error:
JsController could not be found.
Error:
Create the class JsController below in file: app\Controller\JsController.php
<?php
class JsController extends AppController {
}
?>
我没有.htaccess文件运行。下面是我的配置:
Listen 9090
<Directory "c:/wamp/apscmdb/">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride none
#
# Controls who can get stuff from this server.
#
# onlineoffline tag - don't remove
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Directory>
<VirtualHost *:9090>
DocumentRoot "c:\wamp\apscmdb"
<Directory "c:/wamp/apscmdb/">
RewriteEngine On
RewriteBase /app/webroot
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</Directory>
</VirtualHost>
我想下面的代码: echo $this->Html->script('portal');
,输出: <script type="text/javascript" src="/js/portal.js"></script>
,我发现这个听起来相似,但没有解决方案已提供: Error: JsController could not be found
您是本地主机或现场服务器相应的网址? –
@FazalRasel ATM,它的本地开发是...使用WAMP。 – TekiusFanatikus
您必须在应用程序目录中使用.htaccess文件 – Anubhav