记录学习laravel的一些问题(坑)

小天天天天    PHP    999+ 次    2018-09-10 15:28:25


问题:laravel转移文件夹到另外一pc或者环境后访问出现500 

设置权限为777 

问题: 设置路由后页面总是404 not found 

解决:需要在apache 配置文件里添加对laravel文件夹的访问按程序

<Directory "D:\WAMP\laravel\public">
    Options Indexes FollowSymLinks
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #此处必须为all none不行
    AllowOverride All
    # Controls who can get stuff from this server.
    #Require all granted
    #Allow Order not supported
    Allow from all 
    Require all granted 
</Directory>

问题:Laravel 5.1中Form组建不能安装 

解决办法: 

先在composer.json的require中加入"laravelcollective/html": "~5.1" ,然后

composer update 

然后config/app.php中加入 providers部分 

Collective\Html\HtmlServiceProvider::class, 

aliases部分

 'Form' => Collective\Html\FormFacade::class, 'Html' => Collective\Html\HtmlFacade::class,

问题: Laravel 5.1不能发邮件 

解决方法: 

1. 设置mail.php后删除了evn(), evn表示读取.evn的变量 用dd(Config::get('mail')); 

2. 输出配置来查看, 更新一次就要清一次cache

php artisan cache:clear 
php artisan config:cache 

3. 设置成ssl验证

array:9 [▼

  "driver" => "smtp"

  "host" => "smtp.163.com"

  "port" => 465

  "from" => array:2 [▼

    "address" => "EMAIL@163.com"

    "name" => "DC"

  ]

  "encryption" => "ssl"

  "username" => "EMAIL@163.com"

  "password" => "PASSWORD"

  "sendmail" => "/usr/sbin/sendmail -bs"

问题: 怎么手动清理配置缓存

 解决:

 命令行可以用

php artisan config:cache 

手动可以写个路由, 然后 

use Artisan; 
public function clearConfigCache() { 
  Artisan::call('config:cache'); 
}

问题:Laravel安装后访问错误, 或访问route后view失效,显示了空白页面

 解决: 

chgrp -R www-data /var/www/laravel //用户组根据自己的来定义 
chmod -R 775 /var/www/laravel/app/storage 

外键约束字段必须是int 10 和 UNSIGNED 属性 如果遇到各种莫名奇怪的问题, 清缓存先!!


如果你觉得本篇文章对您有帮助,请打赏作者

上一篇: Laravel5 找不到Form 类的解决办法

下一篇: Laravel 超好用代码提示工具 Laravel IDE Helper

最新评论

暂无评论

热门文章

最新评论

网站数据

网站文章数:481

今日UV/PV/IP:7/7/7

昨日UV/PV/IP:18/19 /18

TOP