【发布时间】:2014-05-15 09:50:49
【问题描述】:
尝试从 webroot 访问 Javascript 文件时,出现以下错误:
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。
-
你必须在app目录中使用.htaccess文件
-
@Anubhav 我试图在不使用 .htaccess 文件的情况下复制它,因为它们在我的生产环境中不可用。
-
See /js/portal.js 将始终寻找没有 .htaccess 的控制器,因此您可以更改 HTML 帮助程序,以便它为 js 和 css 文件创建不同的路径
标签: php apache cakephp httpd.conf