前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >【玩转腾讯云】Laravel 笔记,持续更新中...

【玩转腾讯云】Laravel 笔记,持续更新中...

原创
作者头像
无忧366
修改2020-04-29 09:08:51
3.9K0
修改2020-04-29 09:08:51
举报
文章被收录于专栏:Hello world

1.composer install或者其他操作报:

代码语言:javascript
复制
A version is required for an API group definition.

可能1:.env文件没有

2.laravel-admin 显示图片在图片地址前添加admin域名,例如:

代码语言:javascript
复制
127.0.0.1:8000/admin/127.0.0.1:8000/uploads/images/1.jpg

原因:.env设置APP_URL错误

代码语言:javascript
复制
错误:APP_URL=127.0.0.1:8000

正确:APP_URL=http://127.0.0.1:8000

3.模仿dingoapi 返回分页

代码语言:javascript
复制

 $dataList = $paginator->transform(function ($item){
                 $data = $transformer->transformData($item);
                 return $data;
          });

4.laravel-admin上传多张图片

controller:

代码语言:javascript
复制
 $form->multipleImage('images', '上传图片');

model:

代码语言:javascript
复制
 public function getImagesAttribute($value){ 
    $array = explode(',', $value); 
    return $array; 
 } 
 public function setImagesAttribute($value){ 
    $this->attributes['images'] = implode(',', $value); 
 }
 

5.接口请求数据库写字段写入不进去

代码语言:javascript
复制
model中$fillable添加字段

6.composer 无法下载扩展文件的问题

代码语言:javascript
复制
 [Composer\Downloader\TransportException]                                                                                     
  The "https://packagist.laravel-china.org/packages.json" file could not be downloaded: Peer certificate CN=`*.phphub.org' di  
  d not match expected CN=`packagist.laravel-china.org'                                                                        
  Failed to enable crypto                                                                                                      
  failed to open stream: operation failed        

原因:composer 全局下载换成中国镜像.

解决:下载源换回默认。修改 composer 配置

composer config -g repo.packagist composer https://packagist.phpcomposer.com

7.报bootstrap/cache directory must be present and writable.错误

mkdir cache

php artisan cache:clear

8. 报这个错误 Missing BC Math or GMP extension.

Hashids requires either theBC MathorGMPextension in order to work.

yum install php-bcmath

chown -R -v nginx:nginx /run/php-fpm/php-fpm.sock

9.file_put_contents(/): failed to open stream: Permission denied

1)php artisan cache:clear 2)chmod -R 777 storage

10.composer update报错

代码语言:javascript
复制
[Composer\Downloader\TransportException]                                                                                                    
  The "https://packagist.laravel-china.org/packages.json" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error mess  
  ages:                                                                                                                                       
  error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed                                                           
  Failed to enable crypto                                                                                                                     
  failed to open stream: operation failed   

composer config repo.packagist composer https://packagist.phpcomposer.com

11.lavale换源

代码语言:javascript
复制
[Composer\Downloader\TransportException] 
 The "https://packagist.laravel-china.org/p/league/fractal%2415238fdcb46cea35d54e55c4b  
 3b27b4b96525d1f9909d9f01b69abff5ef0b57a.json" file could not be downloaded: SSL opera  
 tion failed with code 1. OpenSSL Error messages: 
 error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed  
 Failed to enable crypto  
 failed to open stream: operation failed 

composer config repo.packagist composer https://mirrors.aliyun.com/composer/

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 1.composer install或者其他操作报:
  • 2.laravel-admin 显示图片在图片地址前添加admin域名,例如:
  • 3.模仿dingoapi 返回分页
  • 4.laravel-admin上传多张图片
  • 5.接口请求数据库写字段写入不进去
  • 6.composer 无法下载扩展文件的问题
  • 7.报bootstrap/cache directory must be present and writable.错误
  • 8. 报这个错误 Missing BC Math or GMP extension.
  • 9.file_put_contents(/): failed to open stream: Permission denied
  • 10.composer update报错
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档