CakePHP错误:在此服务器上找不到请求的地址'/ unsigned_images / index'

时间:2011-08-17 01:23:34

标签: php cakephp frameworks

我是初学者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>

非常感谢您的帮助! :)

1 个答案:

答案 0 :(得分:3)

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

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

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

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

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