• Laravel Auth 使用Http Basic Authenticate基本认证,不使用数据库

    首先 先创建一个自定义的中间件auth basic认证 使用laravel artisan 例如名称为:HttpBasicAuth, HttpBasicAuth这个名称自定义 在cmd里执行 php artisan make:middleware HttpBasicAuth 创建成功之后在这个目录里 app\Http\Middleware\HttpBasicAuth.php 打开HttpBasic…

    学习 2020-11-01 2766

  • Laravel 8 Target class [xxxxxxController] does not exist

    原本是这么写的 Route::get('/index','IndexController@index'); Laravel 8 的话需要这么写, use App\Http\Controllers\IndexController; Route::get('/index', [IndexController::class, 'index']); 参考: https://laravel.com/docs…

    学习 2020-10-26 2051

  • lnmp配置laravel

    可参考这篇文章与thinkphp配置基本一致:https://www.blyoo.com/4202.html 除了第一步需要改成laravel include rewrite/laravel.conf; 后续基本一致

    学习 2020-09-21 1604

  • laravel LogicException Please make sure the PHP Redis extension is installed and enabled

    首先先确定,laravel redis配置均为正确且redis也已安装的时候 还是提示这个错误Please make sure the PHP Redis extension is installed and enabled 那么看看一看php redis拓展是不是没打开 以我win10 phpstudy为例 环境>php>设置 拓展组件>把redis打开 或者 网站>管理>php拓展>找到red…

    学习 2020-05-18 6821

  • laravel ajax post请求携带csrf token

    jquery 写法 $.ajaxSetup({ headers: { 'X-XSRF-TOKEN': getCookie('XSRF-TOKEN') } }); //下面执行post请求 $.post() 封装一个取cookie函数 这个我经常使用,每次用到了就去w3school复制一下 function getCookie(cname) { var name = cname + "="; var…

    学习 2020-03-27 3757

  • laravel 时间不对

    Laravel 少了8小时,需要把 timezone 设置成上海 找到app/config/app.php 'timezone'='UTC', 改成 'timezone'='Asia/Shanghai', 参考: https://blog.csdn.net/qq_34827048/article/details/79813251

    学习 2020-03-26 2194

  • laravel 定时

    创建任务 使用artisan命令创建一个测试任务 php artisan make:command Test 创建成功 app/Console/Commands/Test.php所在位置 app/Console/Commands/Test.php内容 class Test extends Command { /** * The name and signature of the console c…

    学习 2020-03-25 2682

  • laravel Error Class ‘App\Http\Controllers\Exception’ not found

    问题 throw new Exception('ok'); 解决 用这个php自带的\Exception throw new \Exception("ok"); try { throw new \Exception('ok'); } catch (\Exception $e) { echo $e->getMessage(); } 或者 先在类前面引入use Exception use Except…

    学习 2020-03-25 3406