CakePHP框架首页: http://www.cakephp.org/
下载后导入工程中,目录结构如下图(使用版本:1.1.19.6305)
CakePHP框架首页: http://www.cakephp.org/
Apache2.2版本的,直接把
2.0以前的版本,据说要修改2个地方:
增加Cotroller模块:
app/controllers/posts_controller.PHP
代码:
PHP
PHP
{
@H_936_301@@H_936_301@@H_936_301@}
{
@H_936_301@@H_936_301@@H_936_301@@H_936_301@@H_936_301@}
{
@H_936_301@{
@H_936_301@@H_936_301@@H_936_301@{
flash('Yourposthasbeensaved.','/posts');@H_936_301@}
}
}
{
@H_936_301@@H_936_301@flash('Thepostwithid:'.$id.'hasbeendeleted.','/posts');@H_936_301@}
{
@H_936_301@{
@H_936_301@@H_936_301@@H_936_301@@H_936_301@@H_936_301@}
{
@H_936_301@@H_936_301@@H_936_301@{
flash('Yourposthasbeenupdated.','/posts');@H_936_301@}
}
}
}
/app/views/下追加posts文件夹,然后再添加4个页面(一般后缀为.rhtml)
代码依次为:
index.thtml
link("AddPost","/posts/add");
PHPforeach($postsas$post):PHPecho$post['Post']['id'];link($post['Post']['title'],'/posts/view/'.$post['Post']['id']);link(
'Delete',
"/posts/delete/{$post['Post']['id']}",
null,
'Areyousure?'
)link('Edit','/posts/edit/'.$post['Post']['id']);PHPecho$post['Post']['created'];PHPendforeach;
view.thtml
edit.thtml
add.thtml
测试URL: http://localhost/phpblog/posts/
参考网页:http://manual.cakephp.org/appendix/blog_tutorial
以下是CakePHP框架的一些特性: http://www.lostk.com/blog/cakephp_note/
测试URL: http://localhost/phpblog/posts/
参考网页:http://manual.cakephp.org/appendix/blog_tutorial
以下是CakePHP框架的一些特性: http://www.lostk.com/blog/cakephp_note/