zoukankan      html  css  js  c++  java
  • Yii2 Lesson

    建立Gii的 CRUD


    先查看是否开发环境,增加自己的IP地址

        $config['bootstrap'][] = 'gii';
        $config['modules']['gii'] = [
            'class' => 'yiigiiModule',
            // uncomment the following to add your IP if you are not connecting from localhost.
            //'allowedIPs' => ['127.0.0.1', '::1','110.82.170.196'],
        ];
    
    

    其次数据库建立个新表

    /*show CREATE table posts */
    
    CREATE TABLE `posts` (
      `post_id` int(11) NOT NULL AUTO_INCREMENT,
      `post_title` varchar(100) NOT NULL,
      `post_description` text NOT NULL,
      `author_id` int(11) NOT NULL,
      PRIMARY KEY (`post_id`),
      KEY `author_id` (`author_id`),
      CONSTRAINT `posts_ibfk_1` FOREIGN KEY (`author_id`) REFERENCES `users` (`user_id`)
     ) ENGINE=InnoDB DEFAULT CHARSET=utf8
    

    然后在 ?r=gii中建立models/post.php 和 CURD

    解决Warning: scandir() has been disabled for security reasons in…的问题
    
    删除  vim /usr/local/php/etc/php.ini 里面的函数 scandir()
    
    重启系统(写多点  用得到的是php-fpm)
    
    /usr/local/nginx/sbin/nginx  -s reload
    service php-fpm restart
    service network restart
    
    
  • 相关阅读:
    20151104内置对象
    20151102adonet2
    20151029adonet1
    20151028c#4
    20151027c#3
    20151026c#2
    20151021c#1
    20151020sql2
    20151019sql1
    Codeforces Round #261 (Div. 2) C. Pashmak and Buses(思维+构造)
  • 原文地址:https://www.cnblogs.com/JsonM/p/7211779.html
Copyright © 2011-2022 走看看