【问题标题】:Unable to load the pictures from MySQL in laravel on google cloud app engine无法在谷歌云应用引擎的 laravel 中从 MySQL 加载图片
【发布时间】:2020-10-28 21:17:42
【问题描述】:

我在谷歌云应用程序引擎上部署了一个 laravel 项目,它工作正常,期待从 MySQL 数据库中的产品表中获取的“图片”。 图片坏了,在本地主机上一切正常。

这是我的 app.yaml:

runtime: php73

handlers:
    - url: /assets
      static_dir: public/assets


    - url: /(.+\.(gif|png|jpg))$
      static_files: public/uploads
      upload: .+\.(gif|png|jpg)$

runtime_config:
    document_root: public

env_variables:
    ## Put production environment variables here.
    APP_KEY: Already Get this from .env
    APP_STORAGE: /tmp
    VIEW_COMPILED_PATH: /tmp
    SESSION_DRIVER: cookie


    CACHE_DRIVER: database
    ## Set these environment variables according to your CloudSQL configuration.
    DB_DATABASE: ufurnitures
    DB_USERNAME: ufurnitures
    DB_PASSWORD: Already set the pass
    DB_SOCKET: /cloudsql/ufurniture:us-central1:ufurnitures

    ## To use Stackdriver logging in your Laravel application, copy
    ## "app/Logging/CreateStackdriverLogger.php" and "config/logging.php"
    ## into your Laravel application. Then uncomment the following line:
    # LOG_CHANNEL: stackdriver


beta_settings:
    # for Cloud SQL, set this value to the Cloud SQL connection name,
    # e.g. "project:region:cloudsql-instance"
    cloud_sql_instances: ufurniture:us-central1:ufurnitures

我在保存图片的公共目录中有一个“上传”文件夹。

【问题讨论】:

    标签: mysql laravel google-app-engine google-cloud-platform gcloud


    【解决方案1】:

    只要改变这个:

    - url: /(.+\.(gif|png|jpg))$
      static_files: public/uploads
      upload: .+\.(gif|png|jpg)$
    

    到这里!

    - url: /uploads
      static_dir: public/uploads
    

    快点成功吧! ^_^

    【讨论】:

      猜你喜欢
      • 2020-10-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-04-10
      • 1970-01-01
      相关资源
      最近更新 更多