【问题标题】:CakePHP Error: The requested address '/unsigned_images/index' was not found on this serverCakePHP 错误:在此服务器上找不到请求的地址“/unsigned_images/index”
【发布时间】:2011-08-17 01:23:33
【问题描述】:

我是一名初学者 CakePHP 开发人员。我遇到了错误:在此服务器上找不到请求的地址“/unsigned_images/index”。

我正在使用以下代码:

型号:app/models/unsigned_image.php

<?php
class UnsignedImage extends AppModel{

    var $name = 'UnsignedImage';
    var $useDbConfig = 'tabletApp';
    var $useTable = 'unsigned_images';
    //var $useTable = false;

}
?>

控制器:app/controllers/unsigned_images_controller.php

<?php
class UnsignedImagesController extends AppController{

    var $name = 'UnsignedImages';
    var $pageTitle = 'Hello world!';
    var $helpers = array('Javascript');
    var $components = array('Auth', 'Slogic');

    function index(){
        $this->layout = 'default';
        $this->set('data','Hello World!');
        $this->set('unsigned_images', $this->UnsignedImage->find('all') );
    }
}
?>

查看:app/views/unsigned_images/index.ctp

<div style='font-weight: bold; margin: 0 0 10px 0;'>View All Signatures</div>

<table>
    <tr>
        <th>ID</th>
        <th>Session ID</th>
    </tr>
    <?php 
        foreach( $unsigned_images as $unsigned_image ){

            echo "<tr>";
                echo "<td>{$unsigned_image['UnsignedImage']['id']}</td>";
                echo "<td>{$unsigned_image['UnsignedImage']['session_id']}</td>";
            echo "</tr>";
        }
    ?>
</table>

非常感谢您的帮助! :)

【问题讨论】:

    标签: php cakephp frameworks


    【解决方案1】:

    两篇博文(herehere)建议了以下步骤:

    1. 确保您的数据库配置正确(表存在,您有权访问等)
    2. 确保/tmp 目录是可写的
    3. 清除/tmp子文件夹中的缓存文件

    由于将$useTable 设置为false 时错误消失,所以我会特别注意第一步。确保您的/app/config/database.php 文件中有相应的tabletApp 数据库配置。

    此外,通过在 core.php 配置文件中设置以下行,可以获得更多有用的故障排除信息:

    Configure::write('debug', 2);
    

    【讨论】:

    • 非常感谢您的链接和 Configure::write('debug', 2);帮助,现在它的工作。 :)
    • 很久没有更新我的模型了,完全忘记了在投入生产后清除缓存。破坏了网站,,新朋友,保存了它。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-01-21
    • 1970-01-01
    • 1970-01-01
    • 2021-12-24
    • 1970-01-01
    • 2017-09-09
    • 1970-01-01
    相关资源
    最近更新 更多