草庐IT

yii-cmodel

全部标签

php - 在 NetBeans 中设置 Yii 2 Web 框架编码标准

我读了this和this.但是如何在Windows机器的NetBeansIDE中设置它呢? 最佳答案 Yii2至少需要PHP5.4,因此如果您的IDE支持PHP5.4或更高版本,那么它也会显示Yii2的标准。您还可以检查这个yiipliginfornetbeanshttp://plugins.netbeans.org/plugin/47246/php-yii-framework-netbeans-phpcc 关于php-在NetBeans中设置Yii2Web框架编码标准,我们在Stack

php - Yii2 : Handling Assets For A custom theme

我已经创建了一个主题,它的工作文件,但它的一个问题是Assets文件不在主题目录中。我在以下路径创建主题/var/www/html/project_name/themes/theme_name而我的主题文件结构是-layoutsmain.php-cssstyle.css-jsscript.js-imageslogo.jpg我把所有的css,js文件路径放在assets/AppAssets.php,所以我的AppAssets.php看起来是namespaceapp\assets;useyii\web\AssetBundle;/***@authorQiangXue*@since2.0*/c

php - GridView 中的 Yii2 列未显示(未设置)

我正在尝试在我的ActiveRecordSearch()中合并3个表。我有这张tableemployeesidfirst_nameprojectsidnameproject_assignmentidemployee_idproject_iddate_addeddate_removed我正在使用GridView显示我数据库中的所有员工。现在,我想显示分配员工的项目。所以说到这里,显然我们需要这3个表来连接。在我的Employees.php模型中,我有这段代码:publicfunctiongetproject_assignment(){return$this->hasMany(Projec

php - Yii2:使用 Swiftmailer 插件 (Openbuildings\Swiftmailer\CssInlinerPlugin)

我的yii2应用程序使用\app\mail\layouts中给定的默认布局成功发送了带有yii2swiftmailer扩展的电子邮件。名为html.php喜欢Yii::$app->mailer->compose('@app/mail/templates/myTemplate',['param1'=>$param1,'param2'=>$param2])->setFrom($senderAdress)->setTo($reveiverAdress)->setSubject('Subject')->send();不幸的是,标题中样式标签内的css不包含在html.php中。正如yii2官方

php - Yii2:Web 服务请求和响应记录器

我正在尝试为在Yii2.0.5中创建的Web服务创建请求和响应记录器以进行调试。基本上我的动机是跟踪所有请求、请求数据、响应数据,为此我使用了Yii事件。到目前为止,我编写了如下代码:用户Controlleruseyii\rest\ActiveController;useyii\base\Event;useyii\web\Response;Event::on(ActiveController::className(),ActiveController::EVENT_AFTER_ACTION,['app\models\LogHandler','saveRequest'],['reques

php - Yii 小数范围的验证规则

我想为小数范围值40.000array('entrance_score','compare','operator'=>'100,'message'=>'MaximumEntranceScoreshouldbe100.'),从GUI进行测试时,可接受小于100的小数,但不能接受大于或等于40.000的小数。下面的规则不能正常工作,我该怎么办?array('entrance_score','compare','operator'=>'>=','compareValue'=>0,'message'=>'MinimumEntranceScoreshouldbe40.'),

php - 在配置文件中访问 session 或 Yii

我想在配置文件中访问session或Yii::$app,例如(config/main.php或config/main-local.php)!这可能吗?我想检查session并提供一些样式!'components'=>['assetManager'=>['assetMap'=>['r.css'=>Yii::$app->session['lang']?'css/styleltr.css':'css/stylertl.css',],],orhowdosomethinglikethatinassetmanager???? 最佳答案 您不能在

php - 登录失败 Yii2 没有错误信息

我目前正在使用Yii2框架。在登录页面,当我登录失败时,它只是刷新View,但没有显示任何错误。这是我目前的观点:title='Welcometomysite';//$this->params['breadcrumbs'][]=$this->title;?>title)?>"login-form","options"=>["class"=>"smart-formclient-form"]]);?>SignInUserEscribetuUsuarioContraseñaTypeyourPasswordForgotyourpassword?RememberMeEntrar$(functio

php - Yii1 中的 URL 管理器和 Htaccess

我有这样的网址:www.studyenglish/index.php?r=site/lesson&act=read&id=1我希望改变为:www.studyenglish/site/lesson/read我已经在urlmanagerconfig/main.php中添加了这个脚本'urlManager'=>array(....'showScriptName'=>false,....),并将此脚本添加到.htaccess中Options+FollowSymLinksRewriteEngineonRewriteBase/#ifadirectoryorafileexists,useitdire

php - Yii2错误: The view file does not exist

我已经使用Yii2几个星期了,并且掌握了它的窍门。然而,今天,由于我不知道的原因,Yii将我路由到错误的页面,导致错误,因为没有找到网页:URL:http://localhost/web/index.php?r=site/indexError:InvalidParameter–yii\base\InvalidParamExceptionTheviewfiledoesnotexist:C:\xampp\htdocs\views\site\index.php但是,自从我开始使用Yii2以来,我已经能够使用http://localhost/web/index.php?r=paramA/par