laravel的核心架构的理解

其实,laravel的模型、控制器、路由、中间件、模板引擎等都还是很好理解的,但laravel的核心架构:服务周期、服务容器、服务提供者、Facades、契约,包括依赖注入对新手而言是比较难理解一点。

但愿看看视频教程和百度一些文章,早日深刻理解。

贴几篇文章链接吧,或许能有所收获:https://www.cnblogs.com/heyue0117/p/12345162.html
https://www.cnblogs.com/lamp01/p/8445587.html

git composer构建的时候报 psr-4的错误

问题:Class App\Servitization\UfileSerivitization located in ./app/Servitization/UfileServitization.php does not comply with psr-4 autoloading standard. Skipping.

解决办法:

规范问题,composer.json的autoload里将报错的文件加上

"autoload": {
        "classmap": [
            "database",
            "database/seeds/updateRate.php",
            "app/Servitization/UfileServitization.php",
            "app/Libs/Contract/Fdd/Data/FddContractManageMent.php",
            "vendor/phpoffice/phpexcel/Classes/"
        ],
        "psr-4": {
            "App\\": "app/"
        },
        "files":[
            "app/Helpers/functions.php"
        ]
    },

解决Laravel错误1071 Specified key was too long的多种方法

SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes

解决Laravel错误1071 Specified key was too long的多种方法

If you are using MariaDB or an older version of MySQL, you need to place this code in your AppServiceProvider.php:

use Illuminate\Support\Facades\Schema; public function boot() { Schema::defaultStringLength(191); }
Inside config/database.php, replace this line for mysql

‘engine’ => null’,
with

‘engine’ => ‘InnoDB ROW_FORMAT=DYNAMIC’,
Instead of setting a limit on your string lenght.

Change database.php which is in config folder where it says

‘charset’ => ‘utf8mb4’, ‘collation’ => ‘utf8mb4_unicode_ci’,
I changed these to

‘charset’ => ‘utf8’, ‘collation’ => ‘utf8_unicode_ci’,

laravel 图片上传与前端显示问题

laravel 是无法访问

storage/app/public/images   里面的图片的

首先

laravel建立storage目录文件到public的软连接

执行命令:php artisan storage:link

命令执行完毕后,就会在项目里多出一个 public/storage,

这个 storage 就是一个软链接,它指向 storage/app/public 目录。

public/storage(软连接) → storage/app/public

然后就可以用地址直接访问public里面的照片了!