在laravel5 不管新增加什麼控制器/model 有用到classmap
請先打composer dump-autoload
避免出現class not found
在laravel5 不管新增加什麼控制器/model 有用到classmap
請先打composer dump-autoload
避免出現class not found
error: failed to push some refs to 'https://github.com/******/*****.git
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
但又遇到問題了,error message如下:! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'https://github.com/*****/*****.git' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.輸入git pull origin master就解決了。 而會發生以上問題的原因,是因為有local branch 和 origin branch的問題。
app/Http/Controllers 目錄下。既然在本指南中我們不打算整合到完整的命名空間,請將 app/Http/Controllers 添加到 composer.json 的 classmap,接下來,您可以從 app/Http/Controllers/Controller.php 基底抽象類別中移除命名空間,並確認整合過來的控制器是繼承這個基底類別。app/Providers/RouteServiceProvider.php 檔案中,將 namespace 屬性設定為 null。'App\Http\Middleware\VerifyCsrfToken',
Input facade definition from config/app.phphence you have to manually add that in to aliases array as below,'Input' => Illuminate\Support\Facades\Input::class,
Input facade directly as required,use Illuminate\Support\Facades\Input;
"autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/controllers/player",
"app/models",
"app/models/player",
"app/database/migrations",
"app/database/seeds",
"app/tests/TestCase.php"
]
},
調整完畢後,使用指令composer dump-autoload原因:
在程式當中使用連線可以做:
'mysql' => array(
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'white',
'username' => 'xxxxxxxx',
'password' => 'xxxxxxxx',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
),
'mysql_player' => array(
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'player',
'username' => 'xxxxxxxx',
'password' => 'xxxxxxxx',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
),
DB::connection('mysqlr')->table('white')->count();
DB::connection('mysql_player')->table('player')->count();
function get_device(){
var ua = navigator.userAgent;
var checker = {
iphone: ua.match(/(iPhone|iPod|iPad)/),
android: ua.match(/Android/)
};
if (checker.android){
return "android";
}
else if (checker.iphone){
return "iphone";
}
else {
return "web";
}
}
composer require mobiledetect/mobiledetectlib
$detect = new Mobile_Detect; $deviceType = ($detect->isMobile() ? ($detect->isTablet() ? 'tablet' : 'phone') : 'computer'); $scriptVersion = $detect->getScriptVersion(); echo "deviceType:".$deviceType."<br>"; echo "scriptVersion:".$scriptVersion."<br>"; echo "Iphone:".$detect->isIphone()."<br>"; echo "isAndroidOS".$detect->isAndroidOS()."<br>"; echo "isiOS".$detect->isiOS()."<br>"; // 注意 // $detect->isIphone() // $detect->isAndroidOS() // $detect->isiOS() // 如果不符合則不會回傳任何資料,符合就會回傳1
curl_setopt($curl,CURLOPT_SSL_VERIFYHOST,0);
curl_setopt($curl,CURLOPT_SSL_VERIFYPEER,0);
$graph_url = "https://graph.facebook.com/me?access_token="
. $params['access_token'];
$curl = curl_init($graph_url);
curl_setopt($curl,CURLOPT_SSL_VERIFYHOST,0);
curl_setopt($curl,CURLOPT_SSL_VERIFYPEER,0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$user_data = curl_exec($curl);