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
    
    
  • 相关阅读:
    「USACO 2020.12 Platinum」Sleeping Cows
    拉格朗日反演 (Lagrange Inversion)
    「ROI 2016 Day1」人烟之山
    「ROI 2016 Day2」二指禅
    ZJOI2016 大森林
    CF1119H Triple
    [ZJOI2016]线段树
    CF1237F
    NOI2018 情报中心
    CF1270I Xor on Figures
  • 原文地址:https://www.cnblogs.com/JsonM/p/7211779.html
Copyright © 2011-2022 走看看