slyyf
普通用户注册就报错啊,求解答啊!!
Caused by: PDOExceptionSQLSTATE[HY000]: General error: 1364 Field 'password_reset_token' doesn't have a default value
in D:\wampserver\wamp64\www\workspace\yii2\iisns\vendor\yiisoft\yii2\db\Command.php at line 844
- slyyf 提出了问题怎么下载一个音频文件或者其他的文件
- slyyf 收藏了教程使用PHP搭建自己的MVC框架
如果你想把图片上传的路劲设置为前台的 frontend\web\upload,方法有很多。
最简单的一种:$model->file->saveAs('../frontend/web/upload/'.$file_name);
../的意思是上一级目录,是相对于index.php的路径说的。
如果设置常量的话,@app应该是相对于当期模块的根路径,那就不用它。
在config目录下新建一个constant.php,写入这样一句话:define('APP_BASE_PATH','../');
然后在index.php调用:
require(__DIR__ . '/../config/constant.php');
然后在图片保存的时候写:
$model->file->saveAs(APP_BASE_PATH.'frontend/web/upload/'.$file_name);
就可以了,而且APP_BASE_PATH这个常量在其他地方也可以使用。总之方法很多,../这个符号可以让你访问到各个目录。
为什么我用在common目录下用../还是会报错move_uploaded_file(../frontend/web/secondarytile.png): failed to open stream: No such file or directory,按理说应该是能找到路径啊?求解答,谢啦!!!
@小马哥 我咋发送不成功那 用的是126的 错误提示
"name": "Exception", "message": "Expected response code 250 but got code \"553\", with message \"553 Mail from must equal authorized user\r\n\"", "code": 0, "type": "Swift_TransportException",
@linqiu126 你的553解决了么??为什么我也显示这个啊?求解答
为什么打开是404啊??
- slyyf 回答了问题 yii2 在控制器验证权限报错
想问一下楼主,这个(Yii::$app->user->can)是什么意思,是某用户是否有权限使用这个controller么?如果是的话,这个权限在哪里设置呢?万分感谢
- slyyf 回复了 x_yunxiang 的评论
访问
http://127.0.0.1:8088/yii2test/frontend/web/
提示Warning: require(D:\phpWeb\yii2test\frontend\web/../../vendor/autoload.php): failed to open stream: No such file or directory in D:\phpWeb\yii2test\frontend\web\index.php on line 5 Fatal error: require(): Failed opening required 'D:\phpWeb\yii2test\frontend\web/../../vendor/autoload.php' (include_path='.;C:\php\pear') in D:\phpWeb\yii2test\frontend\web\index.php on line 5
你有没有解决这个问题啊,我也遇到了
楼主,在我进行完第四步之后会报这样的错,是为什么呢??
D:\wampserver\wamp\wamp\www\yii2\advanced>php composer.phar global require "fxp/
composer-asset-plugin:1.0.0"
Changed current directory to C:/Users/yyf/AppData/Roaming/Composer
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)- Installing fxp/composer-asset-plugin (v1.0.0)
Loading from cache
Fatal error: Call to undefined method Fxp\Composer\AssetPlugin\Package\Version\V
ersionParser::parseLinks() in C:\Users\yyf\AppData\Roaming\Composer\vendor\fxp\c
omposer-asset-plugin\Repository\VcsPackageFilter.php on line 272Call Stack:
0.0130 404864 1. {main}() D:\wampserver\wamp\wamp\www\yii2\advanced\co
mposer.phar:0
0.0130 407800 2. require('phar://D:/wampserver/wamp/wamp/www/yii2/adva
nced/composer.phar/bin/composer') D:\wampserver\wamp\wamp\www\yii2\advanced\comp
oser.phar:250.1100 4404216 3. Composer\Console\Application->run() phar://D:/wampser
ver/wamp/wamp/www/yii2/advanced/composer.phar/bin/composer:43
0.1190 4814128 4. Symfony\Component\Console\Application->run() phar://D
:/wampserver/wamp/wamp/www/yii2/advanced/composer.phar/src/Composer/Console/Appl
ication.php:82应该输入composer global require "fxp/composer-asset-plugin:~1.0.3"就好了
- Installing fxp/composer-asset-plugin (v1.0.0)
楼主,在我进行完第四步之后会报这样的错,是为什么呢??
D:\wampserver\wamp\wamp\www\yii2\advanced>php composer.phar global require "fxp/
composer-asset-plugin:1.0.0"
Changed current directory to C:/Users/yyf/AppData/Roaming/Composer
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)- Installing fxp/composer-asset-plugin (v1.0.0)
Loading from cache
Fatal error: Call to undefined method Fxp\Composer\AssetPlugin\Package\Version\V
ersionParser::parseLinks() in C:\Users\yyf\AppData\Roaming\Composer\vendor\fxp\c
omposer-asset-plugin\Repository\VcsPackageFilter.php on line 272Call Stack:
0.0130 404864 1. {main}() D:\wampserver\wamp\wamp\www\yii2\advanced\co
mposer.phar:0
0.0130 407800 2. require('phar://D:/wampserver/wamp/wamp/www/yii2/adva
nced/composer.phar/bin/composer') D:\wampserver\wamp\wamp\www\yii2\advanced\comp
oser.phar:250.1100 4404216 3. Composer\Console\Application->run() phar://D:/wampser
ver/wamp/wamp/www/yii2/advanced/composer.phar/bin/composer:43
0.1190 4814128 4. Symfony\Component\Console\Application->run() phar://D
:/wampserver/wamp/wamp/www/yii2/advanced/composer.phar/src/Composer/Console/Appl
ication.php:82- Installing fxp/composer-asset-plugin (v1.0.0)