找不到CakePHP JsController。

时间:2014-04-03 13:49:41

标签: php apache cakephp httpd.conf

尝试从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

1 个答案:

答案 0 :(得分:1)

解决方案:

  1. 使用.htaccess文件
  2. 或修改HTML帮助程序以输出适用于webroot的URL