yii2
「已注销」
这个作者很懒,什么都没留下…
展开
-
yii的main.php里面post和get的大小写要求
['class'=>'yii\rest\UrlRule','controller'=>'v2/movie-list', 'extraPatterns'=>[ 'get list'=>'list' ] ], ['class'=>'yii\rest\UrlRule','control...原创 2020-05-09 18:32:56 · 279 阅读 · 0 评论 -
yii,mysql查询怎么随机获取数据?
转载来源:https://www.yiichina.com/question/2276?sort=descmysql查询怎么随机获取数据? [ 2.0 版本 ]lzrqyc1102016-09-27 11:30:363315次浏览3条回答0悬赏 30 金钱用Yii框架模型怎么写随机获取数据?不是用sql语句,求帮忙,/** 随机获取10道题*/public function getRandquestions(){ return $this->find...转载 2020-05-09 18:30:37 · 1183 阅读 · 0 评论 -
uniapp用post请求yii后端出现undefined index 错误
查看app.log,$_POST['']空空如也。https://ask.dcloud.net.cn/question/77082加上 "Content-Type": "application/x-www-form-urlencoded"试试复制代码uni.request({ url: 'https://www.example.com/request', //仅为示例,并...原创 2020-05-07 19:02:55 · 628 阅读 · 0 评论 -
Yii2:PHP Notice – yii\base\ErrorException Undefined variable: model
魏曦视频,privilege页面,总是提示PHP Notice–yii\base\ErrorExceptionUndefined variable: model不明白.看以前的,才发现,adminuser\views\privilege.php,开头需要$model=Adminuser:findOne($id).phpstorm会提示undefined variable $...原创 2020-02-22 16:10:07 · 1046 阅读 · 0 评论 -
yii rbac权限管理:删除文章,你没有执行此操作的权限!
折腾一个上午,想看哪里出问题.结果发现是ACF没有增加delete.上网浪费了几天时间,和流氓争论.结果微博被20231了.悲剧.也不说原因.人家发什么黄呀,都可以....原创 2020-02-22 13:52:07 · 355 阅读 · 0 评论 -
Yii2.0 RESTful API 基础配置教程
https://www.cnblogs.com/hedeqiang/p/11206365.htmlhttps://www.cnblogs.com/echojson/p/10773744.html原创 2020-02-13 22:16:26 · 100 阅读 · 0 评论 -
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in E:\WWW\blog\hyii2\frontend\web\index.php
yii2.0.32.高级模板。Parse error: syntax error, unexpected T_OBJECT_OPERATOR in E:\WWW\blog\hyii2\frontend\web\index.php on line 17https://www.imooc.com/qadetail/189883这个是语法报错,你首先要去检查E:\WWW\blog\hyi...原创 2020-02-13 21:02:56 · 1386 阅读 · 0 评论 -
在 Yii 2 的 RESTful 服务中,GET URL /,响应404的解决(响应200)
魏熙视频,yii2.restful,curl连接后只有404。莫名其妙。正在解决中,还没有办法。参考以下网址:1.https://www.yiichina.com/question/2589好像没看清楚办法。因为我用的是phpstudy2020自己配置的。2.https://www.shuijingwanwq.com/2017/08/29/1743/1、在 APM 监控中,...原创 2020-02-13 15:44:45 · 767 阅读 · 0 评论 -
yii2下,tabel设置width无效
魏曦的视频……去年完全没有的问题,现在:DetailView::widget'template'=>'<tr><th style="width:120px;height:100px;color: #1c7430;"><div>{label}</div></th><td>{value}</td><...原创 2020-02-10 14:06:57 · 184 阅读 · 0 评论 -
yii2,数据库表名是下划线,gii生成控制器是驼峰命名,结果没有view页面?
自己的访问地址:http://back.blog/index.php?r=flat_info/index看看:改成减号,中间横线,结果:View not Found–yii\base\ViewNotFoundExceptionThe view file does not exist:原来要手工把生成的views/flat_info/index.php改成views/...原创 2020-02-09 17:04:44 · 421 阅读 · 0 评论 -
win7上传yii代码到centos7后报错
上传后先php init,index文件就有了。但是,昨天一天都是直接浏览器打不开。今天进步了,Warning: require(/home/html/frontend/web/../../vendor/autoload.php): failed to open stream: No such file or directory in /home/ccc/html/rent_ho...原创 2019-09-05 11:23:47 · 172 阅读 · 0 评论 -
composer:Could not open input file: composer.phar
centos7,nginx,php7.2.刚刚安装了composer后安装yiibasic,第一次失败,换了阿里云源之后成功。结果现在又不行了。https://blog.csdn.net/DannyIsCoder/article/details/84582080解决方法:php -r "readfile('https://getcomposer.org/installer')...原创 2019-09-04 10:51:59 · 601 阅读 · 0 评论 -
session_start(): open(/var/lib/php/session...)failed: No such file or directory (2)
centos7,php7.2,nginx,win7登陆虚拟机yii basic报错。PHP Warning – yii\base\ErrorExceptionsession_start(): open(/var/lib/php/session/sess_rqibgilrftrru17cs8sgq0fr66, O_RDWR) failed: No such file or directory...原创 2019-09-04 10:15:24 · 3127 阅读 · 0 评论 -
Invalid Configuration – yii\base\InvalidConfigException
yii搭建微信公众号后台,很多bug。虽然学了差不多一个月,依然很陌生。按照以下教程依然不行。很多错误。https://www.yiichina.com/tutorial/848一个错误如题。弄了很久,没办法。上网找答案https://blog.csdn.net/sqz635262108/article/details/79775808...原创 2019-08-23 00:32:36 · 3899 阅读 · 0 评论 -
composer安装yii,backend和frontend没有index.php
需要复制一份backend或者是frontend变成api,结果呢?没有index.php……反反复复都没有……一定是我的硬盘出了问题……重新composer create-project也没有啊……前两天还可以的啊???一定是github出了问题……绝对是……嗯,等一等,等一等,github文档有init……哦,我都忘记了……需要php init,之后就自动生成了...原创 2019-08-17 22:56:16 · 257 阅读 · 0 评论 -
微信公众号没有输出
用return没有输出,echo就可以了。不明白~~~原创 2019-08-25 22:55:25 · 141 阅读 · 0 评论 -
php版本冲突,yii高级模版advanced安装后注册报错:Swift\Mime\SimpleMessage.php:syntax error, unexpected '?'
报错信息部分如下。1. in J:\apitpl\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Mime\SimpleMessage.php at line 490481482483484485486487488489490491492493494495496497498499 * * @return int ...原创 2019-07-24 16:47:43 · 447 阅读 · 0 评论 -
win7,64位,phpstudy2018升级mysql到5.7
费了九牛二虎之力。几个小时。查找和参考满满的几十个经验文档。先是粗浅尝试,后来是复制黏贴,后来是深入文件和错误记录log,最后没有办法,再逐一摸索。无语了。有什么经验呢?太多了。我记不清楚。大概回忆。一个问题是管理员账户需要从附件里面的cmd打开。上下文右键虽然是管理员,貌似是不行的。http://www.360kuai.com/pc/91c53bced...原创 2019-07-25 00:35:27 · 192 阅读 · 0 评论 -
如何通过composer安装yii2 高级模板advanced,用阿里云镜像,快
很多参考文章。我的系统是win7 64位,phpstudy2018不知道多少位。现在升级了php7.2.10-nts,还有mysql64位的5.7.24,不过这关系不大?譬如:使用composer安装yii2高级版参考:https://blog.csdn.net/jiuyue9561/article/details/852960191.首先需要设置composer镜像。前几天用...原创 2019-07-25 06:23:04 · 782 阅读 · 1 评论 -
yii的高级模板的注册用户需要激活才可以登陆,发邮件激活?
折腾了四个多小时……前几天就发现了,以为是魏曦的课件数据库文件设置有问题。想不到是自己申请注册成功之后都是这样。上网到处查不到,魏曦视频也没有。反反复复重装。然后硬着头皮去调试。跑进去里面的官方模板文件不断调试输出,最后发现在本地生成的\common\model\User.php里面public static function findByUsername($userna...原创 2019-07-25 10:15:22 · 291 阅读 · 0 评论 -
yii报错: Cannot use 'Object' as class name as it is reserved in yii2\base\Object.php on line 77
Cannot use 'Object' as class name as it is reserved in J:\apitpl\vendor\yiisoft\yii2\base\Object.php on line 77为什么呢?原来是升级php7.2惹的祸。现在学魏曦yii2.0reseful api视频,讲解非常简略,所以需要源代码。然而源代码却是php5.6还是5.4的...原创 2019-07-25 17:06:51 · 3562 阅读 · 0 评论 -
yii RBAC权限错误:Duplicate entry 'createPost' for key 'PRIMARY'
首先自然是检查RbacController.php有没有问题啦。但是修改了还是不行……$ ./yii rbac/initException 'yii\db\IntegrityException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'createPost'...原创 2019-07-23 07:07:05 · 378 阅读 · 0 评论 -
php中单引号和双引号……
魏曦的yii课程,优酷,yii,1.5倍速,2018年12月?实际貌似是2015……7-1,6分14秒左右代码:frontend/views/post/_listitem.php <div class="nav"> <span class="glyphicon glyphicon-tag" aria-hidden="true"><...原创 2019-07-23 11:31:27 · 88 阅读 · 0 评论 -
property of non-object,yii错误
魏曦yii视频,文章详情,$userMe->email,总是这个提示出错。 public function actionDetail($id) { //step1:准备数据模型 $model=$this->findModel($id); $tags=Tag::findTagWeights(); $...原创 2019-07-23 15:17:25 · 582 阅读 · 0 评论 -
Call to undefined method HTMLPurifier::process()
yii报错。都是正常引入啊!按照提示……上网查,还有看源码……原来自动提示都是错的。自己需要手动use。悲哀!use yii\helpers\HtmlPurifier;原创 2019-07-23 15:38:40 · 169 阅读 · 0 评论 -
yii Trying to get property of non-object错误
魏曦yii2.0,restful 视频,第四课,2:33。return $model->createdBy->realname,总是报错:Trying to get property of non-objectpublic function fields() { return [ 'id', ...原创 2019-08-05 15:07:42 · 1452 阅读 · 0 评论 -
The "query" property must be an instance of a class that implements the QueryInterface
yii实现分页。出现问题。代码如下,详细看魏曦restful 第四课,5:45。<?phpnamespace api\controllers;use common\models\Article;use yii\data\ActiveDataProvider;use yii\rest\ActiveController;class ArticleController ...原创 2019-08-05 16:09:00 · 916 阅读 · 0 评论 -
yii2 api开发进阶
魏曦视频差不多的几个博客。yii2 api开发进阶https://blog.csdn.net/lyb8010/article/details/87250454YII2 advanced 高级版本项目搭建-添加API应用以及多应用https://blog.csdn.net/qq_21956483/article/details/80742970Yii2.0 快速搭建Restful...原创 2019-08-05 16:59:36 · 158 阅读 · 0 评论 -
yii 实现获取top10排序结果的数据库操作语句
不是很熟悉。记录如下。魏曦视频第四课9:22.或者是之前转的yii高级进阶博客也有。<?phpnamespace api\controllers;use common\models\Article;use yii\db\Query;use yii\rest\Controller;class Top10Controller extends Controlle...原创 2019-08-05 17:10:06 · 320 阅读 · 0 评论 -
yii的HttpBasicAuth不能够通过
魏曦视频。httpbasicAuth认证不可以通过。反反复复弹窗。ArticleController代码如下:<?phpnamespace api\controllers;use common\models\Adminuser;use common\models\Article;use yii\data\ActiveDataProvider;use yii\filt...原创 2019-08-05 19:42:29 · 422 阅读 · 0 评论 -
yii测试api接口,提示404
postman输入:api.xx.com/articles。结果404.找来找去,原来是main.php出错:'urlManager' => [ 'enablePrettyUrl' => true, 'showScriptName' => false, 'rules' => [ ['class'=>'yii\res...原创 2019-08-18 17:53:34 · 1004 阅读 · 0 评论 -
如何去掉yii和tp本地测试域名里面的index.php?
之前用tp,不知道怎么去掉index.php,看魏曦yii才明白。现在补充一下。我用phpstudy的集成环境,打开apache的vhosts.conf.做出以下修改替换。<VirtualHost *:80> DocumentRoot "J:\blogdemo3\frontend\web" ServerName blog.com ServerAli...原创 2019-08-09 10:52:23 · 109 阅读 · 0 评论 -
Yii 报错:Undefined index: HTTP_RAW_POST_DATA
找不到这个$GLOBALS['HTTP_RAW_POST_DATA']https://www.yiichina.com/topic/6297?sort=desc关闭csrf,然后Yii::$app->request->getRawBody()$config = ['id' => 'basic','basePath' => dirname(__DIR...原创 2019-08-24 19:11:40 · 353 阅读 · 0 评论 -
composer安装yii高级模版的php版本不符
现在要求php7.0以上composer create-project --prefer-dist yiisoft/yii2-app-advanced apitplInstalling yiisoft/yii2-app-advanced (2.0.22) - Installing yiisoft/yii2-app-advanced (2.0.22): Loading from cac...原创 2019-07-24 15:08:23 · 513 阅读 · 0 评论