怎样把localhost/index.php?r=user变为localhost/user1.修改backend/config/main.php,在components数组中增加 'urlManager' => [ 'enablePrettyUrl' => true, 'showScriptName...
分类:
Web程序 时间:
2015-05-29 17:36:57
阅读次数:
179
1.user表数据结构 2.修改advanced/common/models/User.php use yii\web\IdentityInterface; class User extends ActiveRecord implements IdentityInterface { //增加方法 p...
给user写相关接口配置:修改UserController.php use yii\rest\ActiveController; use yii\helpers\ArrayHelper; use yii\web\Response; class UserController extends Activ...
直接上代码:$db = Yii::$app->db;$transaction = $db->beginTransaction(); //开启事务try { // 更新member表 $db->createCommand()->update('member',[ 'level' ...
分类:
其他好文 时间:
2015-05-29 15:23:23
阅读次数:
122
在web下希望加个core.php的后台入口,但因为权限问题,总是会跳转到index.php解决方案:在core.php 引用的配置文件main-core.php加入如下代码: 'components' => [ 'urlManager'=>[ 'showScri...
分类:
其他好文 时间:
2015-05-26 18:30:53
阅读次数:
155
5月份YII2学习任务基本上告一段落了,总体感觉只是简单学习了YII2,可以进行基本的应用开发,文档没有全部看完,自己简单做了一个QA问答系统进行练手。 QA问答系统功能: 1、登陆、注册、收藏、关注 2、问答 3、文...
分类:
其他好文 时间:
2015-05-25 22:39:26
阅读次数:
147
首先,简单介绍下工厂模式: 在大型系统中,许多代码依赖于少数几个关键类。需要更改这些类时,可能会出现困难。例如,假设您有一个从文件读取的 User 类。您希望将其更改为从数据库读取的其他类,但是,所有的代...
分类:
Web程序 时间:
2015-05-25 20:45:40
阅读次数:
139
Yii2开发过程中也许需要让jquery包在head里面加载,下面是Yii2 让jquery包在head里面例子...
分类:
Web程序 时间:
2015-05-19 14:55:17
阅读次数:
149
1、文件路径:advanced/console/migrations/m130524_201442_init.php 2、补充点:增加约束“username”“email”验证的唯一性: 原代码: <?php
use?yii\db\Schema;
use?yii\db\Migration;
class?m130524_2...
分类:
数据库 时间:
2015-05-18 09:21:16
阅读次数:
210
Yii2 基于RESTful架构的 advanced版API接口开发 配置、实现、测试环境配置:开启服务器伪静态本处以apache为例,查看apache的conf目录下httpd.conf,找到下面的代码LoadModule rewrite_module modules/mod_rewrite.so...