Laravel
  • Introduction
  • 常用語法
  • 結合Vue.js從無到有架設一個網站
  • 透過CMD新增File
  • Schedule
  • Annotation
  • Super Variable
  • API的設定
  • Create 新專案
  • Raw Expressions
  • Import - Export
  • JWT 外加 登入功能
  • Carbon
  • Storage 保存文件
  • Require_once
  • 設定apache將laravel專案run起來
  • 有關leftjoin的用法
  • Advanced Join Clauses
  • Call API方式
  • 產生新的APP_KEY
  • 程序優化技巧
  • composer update VS 手動丟檔
  • 全域變數被使用過
  • FB的SDK
Powered by GitBook
On this page

Was this helpful?

全域變數被使用過

之前專案有遇過一個問題就是全域變數被使用過,但是我看不出哪邊被使用,於是上網查了一下。

網友這麼教,直接針對那要定義的全域變數設定一個if else就可以了,判斷說他是否已經被定義,如果沒有就定義,如果有就跳過。

網友解釋說,如果有某個controller已經宣告過全域變數的話,其他controller就不能再宣告一次,全域變數很強大。

if (!defined('GOOGLE_API_ID')) define('GOOGLE_API_ID', config('global.google_api_id'));
Previouscomposer update VS 手動丟檔NextFB的SDK

Last updated 5 years ago

Was this helpful?