class ObjectObject类实现了类的多种特性 public function __get($name) { $getter = 'get' . $name; if (method_exists($this, $getter)) { ...
分类:
其他好文 时间:
2014-09-29 16:54:01
阅读次数:
304
* YII2版本为 yii basic 2.0.0RC* YII2框架在 /vendor/yiisoft/yii2 目录下,所涉及文件都以此目录为基础* 文本为个人学习内容,如有不正确的地方欢迎指正。在web的入口文件index.php中有包含yii2的核心文件Yii.phprequire(__DI...
分类:
其他好文 时间:
2014-09-29 12:36:10
阅读次数:
202
安装好YII2 后出现 如下图错误提示:解决方法如下:打开安装好的YII2项目目录(YII2安装方法参见 摘取天上星 的博文:http://blog.csdn.net/zqtsx/article/details/39344913)打开YII2项目目录里的 composer.json 文件 (如下图)在composer.json 文件里添加 如下(extra括号里的部分)代码:修改后的compose...
分类:
Web程序 时间:
2014-09-17 18:45:32
阅读次数:
591
1.在写入session的页面。use yii\web\Session;$session = new Session;$session->open();2.在获取session的页面use yii\web\Session;$session = new Session;$session->open()...
分类:
其他好文 时间:
2014-09-15 14:13:08
阅读次数:
165
1. view中显示文本域的位置 field($goods_model, 'goods_introduce')->textArea(['class'=>'intr','rows'=>3]) ?>2.要在该文本域中添加默认值,需要在view中设置,不能使用value="",textarea本身没有va...
分类:
其他好文 时间:
2014-09-12 14:57:33
阅读次数:
253
本实例是对商品列表进行分页1.Controller中,商品列表的方法actionList 引用分页类 actionList中: $goods_info=Goods::find()->joinWith('brand','category')->orderBy('goods.goods_id desc....
分类:
其他好文 时间:
2014-09-10 12:14:10
阅读次数:
209
1.页面视图(我放在了布局文件main.php中): | 显示效果如图:在视图页面添加js代码获取语言设置2.在目录的web/index.php中,获取语言设置$application ->language = isset($_COOKIE['language']) ? htmlspecialcha...
分类:
其他好文 时间:
2014-09-05 12:47:11
阅读次数:
650
link($name)会使用..get$name...即有hasmany和hasone... // update lazily loaded related objects if (!$relation->multiple) { $this->_related[$name] =...
分类:
其他好文 时间:
2014-09-04 09:39:38
阅读次数:
203
//转发$this->render('page1',['id'=>3,'mark'=>2]); //显示page1页面 并传递 id mark 2个参数//重定向$this->redirect(['/home/index']); //重定向到首页
分类:
其他好文 时间:
2014-08-27 18:19:08
阅读次数:
239
$customer=new Customer();//插入操作$customer->name='小熊';$customer->save();//修改操作$model=Customer::findOne(1);$model->name='小洋';$model->save();/* ----------...
分类:
其他好文 时间:
2014-08-27 18:12:59
阅读次数:
22790