dongma7725 2014-04-03 13:49
浏览 25
已采纳

找不到CakePHP JsController。

When trying to access Javascript files from the webroot, I get the following error:

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 {

  }
?>

I'm running without .htaccess files. Here is my configuration:

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>

I'm trying the following code: echo $this->Html->script('portal');

Which outputs: <script type="text/javascript" src="/js/portal.js"></script>

I found this that sounds similar, but no solution has been provided: Error: JsController could not be found

  • 写回答

1条回答 默认 最新

  • douping6871 2014-04-04 12:43
    关注

    Solution:

    1. Either use .htaccess files
    2. Or modify the HTML helper to output the appropriate URLs for webroot
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效