我的
系统是win2000 +iis
原来有
php环境。
我
数据库连接上了。
Your database configuration file is present.
Cake is able to connect to
the database.
这个什么意思:
Editing this Page
To change the content of this page, create: /app/views/pages/home.thtml.
To change its layout, create: /app/views/layouts/default.thtml.
See the views section of the manual
for more info
You can also add some CSS styles for your pages at: app/webroot/css/.
我写测试
实例:
新建news表 里面的
字段 id,title,content,time,sort
因为一定要操作news这个表,所以先建立news的model
/app/models/news.php
<?
class news extends AppModel{
var $name='news';
}
?>
然后新建/app/controllers/news_controller.php
<?
class newsController extends AppController{
var $uses=array('news'); //使用news这个模型
function index(){
$this->set('lists',$this->news->findAll())
} //默认
function add($id=0){
if($id){
$this->set('id',$id);
$this->news->id=$id;
}
if(!empty($this->data)){
$ret=$this->news->save($this->data['news']);
if($ret){
if($id)
$this->flash('更新成功','/news/');
else
$this->flash('添加成功','/news/');
}else{
if($id)
$this->flash('更新失败','/news/add/'.$id);
else
$this->flash('添加失败','/news/add');
}
}
exit();
} //添加/修改
function delete($id){
$this->news->id=$id;
$ret=$this->news->remove();
if($ret)
$this->flash('删除成功','/news/');
else
$this->flash('删除失败','/news/');
exit();
} //删除
function view($id){
$this->news->id=$id;
$this->set('news',$this->news->find());
}
}
?>
这样就可以访问
所以
文件放在/app/views/news/目录下
add.thtml:
<?echo $html->formTag('new/title'.$id);?>
<?echo $html->input('new/title');?>
<?echo $html->textarea('new/content');?>
<?echo $html->submit('submit');?>
</form>
index.thtml:
news:
<br>
<?
for($i=0;$i<count($lists);$i++){
?>
title:<?=$lists[$i]['news']['title']?>
<?
}
?>
view.thtml:
title:<?=$news['news']['title']?>
content:<?=$news['news']['content']?>
http://192.168.0.92:8080/cake/app/news
显示没有找到网页
我调试环境都一上午了。还是不好使,请高手指点一下。
[
本帖最后由 光明之子 于 2008-4-12 13:44 编辑 ]