摘要: yii2利用自带UploadedFile上传图片public static function uploadFile($name) { $uploadedFile = UploadedFile::getInstanceByName($name); if... 阅读全文
posted @ 2015-09-24 13:39 慕尘 阅读(694) 评论(0) 推荐(0) 编辑
摘要: js中uploader = WebUploader.create({ // 自动上传。 auto : true, // swf文件路径 swf : 'webuploader/Uploader.swf', // 文件接收服务端。 ... 阅读全文
posted @ 2015-09-24 13:28 慕尘 阅读(805) 评论(0) 推荐(0) 编辑
摘要: public $layout = 'layout';//在类中定义一个变量,名为$layout的php文件 阅读全文
posted @ 2015-09-24 09:40 慕尘 阅读(500) 评论(0) 推荐(0) 编辑
摘要: 添加use yii\helpers\Url;view中的连接//post为你的当前控制器名,index为view模版 阅读全文
posted @ 2015-09-24 09:27 慕尘 阅读(864) 评论(0) 推荐(0) 编辑
摘要: yii2判断数据是否存在$exists = ModelName::find()->where([ 'column_name' => $value])->andWhere(['column_name' => $value])->exists(); 阅读全文
posted @ 2015-09-24 09:06 慕尘 阅读(309) 评论(0) 推荐(0) 编辑
摘要: 出现400错误是yii2.0的csrf防范策略导致在components里面添加request配置如下:'request' => [ // !!! insert a secret key in the following (if it is empty) - this is required ... 阅读全文
posted @ 2015-09-24 01:16 慕尘 阅读(506) 评论(0) 推荐(0) 编辑