2016年5月31日 星期二
json response by cut off
- https://gist.github.com/magnetikonline/11312172
nginx addition under row
fastcgi_buffering off;
2016年5月26日 星期四
SQL Command Line Interface(CLI)
//show tables index, unique
SHOW INDEX FROM [table];
//show table sehema
SHOW COLUMNS FROM [table];
// show foreign
SELECT
ke.referenced_table_name parent,
ke.table_name child,
ke.constraint_name
FROM
information_schema.KEY_COLUMN_USAGE ke
WHERE
ke.referenced_table_name IS NOT NULL;
SHOW INDEX FROM [table];
//show table sehema
SHOW COLUMNS FROM [table];
// show foreign
SELECT
ke.referenced_table_name parent,
ke.table_name child,
ke.constraint_name
FROM
information_schema.KEY_COLUMN_USAGE ke
WHERE
ke.referenced_table_name IS NOT NULL;
2016年5月25日 星期三
2016年5月23日 星期一
InAppBrowser
InAppBrowser
function isFacebookApp() {
var ua = navigator.userAgent || navigator.vendor || window.opera;
return (ua.indexOf("FBAN") > -1) || (ua.indexOf("FBAV") > -1);
}
參考網址:
function isFacebookApp() {
var ua = navigator.userAgent || navigator.vendor || window.opera;
return (ua.indexOf("FBAN") > -1) || (ua.indexOf("FBAV") > -1);
}
參考網址:
2016年5月18日 星期三
2016年5月9日 星期一
[FB][分享]javascript sdk
參考網址:
- https://dotblogs.com.tw/suehilary/2012/02/08/68441
- [登入] https://developers.facebook.com/docs/javascript/examples#login
- [javascript sdk] https://developers.facebook.com/docs/javascript/examples
javascript範例:
//判斷是否登入中
function checkLoginState() {
FB.getLoginStatus(function(response) {
statusChangeCallback3(response);
});
}
// 判斷登入狀態
function statusChangeCallback3(response) {
console.log('statusChangeCallback');
// The response object is returned with a status field that lets the
// app know the current login status of the person.
// Full docs on the response object can be found in the documentation
// for FB.getLoginStatus().
if (response.status === 'connected') {
// Logged into your app and Facebook.
api_me(response);
// console.log(response);
} else if (response.status === 'not_authorized') {
// The person is logged into Facebook, but not your app.
console.log('not_authorized');
// document.getElementById('status').innerHTML = 'Please log ' + 'into this app.';
} else {
// The person is not logged into Facebook, so we're not sure if
// they are logged into this app or not.
console.log('else');
// document.getElementById('status').innerHTML = 'Please log ' + 'into Facebook.';
}
}
// 登入中取得資訊後,像後端傳送資料
function api_me(login_status) {
var access_token = login_status.authResponse.accessToken;
FB.ui({
method: 'feed',
name: '分享標題',
link: 'https://google.com',//分享連結
picture: 'https://google.com',//分享圖片
caption: '分享資訊',
description: '分享資訊'
}, function(response) {
if (response && response.post_id) {
var post_id = response.post_id;
FB.api('/me?fields=email,name,first_name,last_name', function(response) {
email = response.email || "";
$.ajax({
url: "", //後台api
dataType: 'json',
method: 'POST',
data: {
'post_id' : post_id,
'name' : response.name,
'account' : response.id,
'email': email,
},
success: function(result) {
console.log(result);
if (result.status=='ok') {
alert('已完成');
} else {
alert('請與客服聯絡');
}
},
error: function(err) {
console.log(err);
alert('發生錯誤');
}
});
});
} else {
alert('Post was not published.');
}
});
}
nginx和centos php設定
nginx file:
fastcgi_pass unix:/var/run/php5-fpm.sock;
change to
fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php5-fpm.sock;
change to
fastcgi_pass 127.0.0.1:9000;
訂閱:
文章 (Atom)