摘要: 页面输出list信息 return $this->render('index', [ 'model' => $model, 'cats' => $cats, 'findlist' => $findall, ]); <?php $str='';foreach ($findlist as $k => $ 阅读全文
posted @ 2017-11-25 22:25 御世制人 阅读(5014) 评论(0) 推荐(1) 编辑
摘要: model public static function getCatlist(){ $cat = ['0' => '暂无分类']; $res = self::find()->asArray()->all(); //print_r($res);die; if($res){ foreach ($res 阅读全文
posted @ 2017-11-25 18:07 御世制人 阅读(223) 评论(0) 推荐(0) 编辑
摘要: 1.简单查询: 应用实例: 2.关联查询: 应用实例: 注:with中的orders对应getOrders 常见问题: 1.在查询时加了->select();如下,要加上order_id,即关联的字段(比如:order_id)比如要在select中,否则会报错:undefined index ord 阅读全文
posted @ 2017-11-25 16:53 御世制人 阅读(230) 评论(0) 推荐(0) 编辑
摘要: 适用情况:比如提交一个表单,提交完成之后在页面展示一条提示消息。 控制器里面这样写: 单条消息: \Yii::$app->getSession()->setFlash('error', 'This is the message'); \Yii::$app->getSession()->setFlas 阅读全文
posted @ 2017-11-25 16:07 御世制人 阅读(1542) 评论(0) 推荐(1) 编辑
摘要: public function actionJiekou(){ $url = 'http://wap.guoshihui.com/_static/wap/video/startVideo.mp4'; //数组数据 $data = array( 'status' => '200', 'message' 阅读全文
posted @ 2017-11-25 11:34 御世制人 阅读(2853) 评论(0) 推荐(0) 编辑
摘要: 【PHP面向对象(OOP)编程入门教程】6.如何去使用对象中的成员 作者:qianyunlai.com 发布于:2012-05-19 15:02 分类:PHP基础 浏览(280) 上面看到PHP对象中的成员有两种一种是成员属性, 一种是成员方法。对象我们以经可以声明了,$p1=new Person( 阅读全文
posted @ 2017-11-25 11:14 御世制人 阅读(228) 评论(0) 推荐(0) 编辑
摘要: 数组转对象 function array2object($array) { if (is_array($array)) { $obj = new StdClass(); foreach ($array as $key => $val){ $obj->$key = $val; } } else { $ 阅读全文
posted @ 2017-11-25 11:02 御世制人 阅读(5855) 评论(0) 推荐(0) 编辑
摘要: 无参数传递 public function actionJiekou(){ $url = 'http://wap.guoshihui.com/_static/wap/video/startVideo.mp4'; $data = array( 'status' => '200', 'message' 阅读全文
posted @ 2017-11-25 00:50 御世制人 阅读(248) 评论(0) 推荐(0) 编辑