我是初学者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>
非常感谢您的帮助! :)