zoukankan      html  css  js  c++  java
  • CakePHP学习之二 简单的测试例子

    1.首先建立自己的表

    SET FOREIGN_KEY_CHECKS=0;
    -- ----------------------------
    -- Table structure for posts
    -- ----------------------------
    CREATE TABLE `posts` (
      `id` int(10) unsigned NOT NULL auto_increment,
      `title` varchar(50) default NULL,
      `body` text,
      `created` datetime default NULL,
      `modified` datetime default NULL,
      PRIMARY KEY  (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=gbk;

    -- ----------------------------
    -- Records
    -- ----------------------------
    INSERT INTO `posts` VALUES ('1', 'The title', 'This is the post body.', '2009-06-16 10:04:05', null);
    INSERT INTO `posts` VALUES ('2', 'A title once again', 'And the post body follows.', '2009-06-16 10:04:05', null);
    INSERT INTO `posts` VALUES ('3', 'Title strikes back', 'This is really exciting! Not.', '2009-06-16 10:04:05', null);
    INSERT INTO `posts` VALUES ('4', '3232', '33', '2009-06-16 06:03:06', '2009-06-16 06:03:06');

    2.在models里添加post.php文件

    <?php
    class Post extends AppModel{
        var $name = 'Post';
    }
    ?>

    3.在controllers目录下添加 posts_Controller.php

    <?php
    class PostsController extends AppController{
       var $name = 'Posts';
      var $scaffold;

     }
    ?>

     4.在ie里输入http://127.0.0.1:8081/posts

    你可以看到下面的效果

     

  • 相关阅读:
    hive高阶函数和采样-优化
    zookeeper搭建
    hive常用函数和建表
    hive常用函数-建表-jdbc
    hadoop远程调试和配置HA
    hadoop-MR-排序
    python spark
    jenkins安装
    beetlsql
    spark页面单跳转化率
  • 原文地址:https://www.cnblogs.com/meetweb/p/1504427.html
Copyright © 2011-2022 走看看