但有時候會誤判,像序號之類的東西在手機上呈現會被iphone加上連結
只要在
<head>裡加上
<meta name="format-detection" content="telephone=no">
這樣就可以關閉iphone判斷電話號碼的功能
<meta name="format-detection" content="telephone=no">
這樣就可以關閉iphone判斷電話號碼的功能
//將 aid 傳入
try{
$aPhoto = $facebook->api(array(
'method' => 'fql.query',
'query' => 'select src,src_big from photo where aid ="'.$aid.'"'
));
}catch(Exception $e) { }
$facebook = new Facebook(
array(
'appId' => $facebook_app_id,
'secret' => $facebook_app_secret,
'cookie' => true,
)
);
//facebook id
$fb_id = $facebook->getUser();
$aLoginParam = array( 'req_perms' => 'user_photos' );
//登入
if( !$fb_id ){
$auth_url = $facebook->getLoginUrl($aLoginParam);
header('Location: '.$auth_url);
exit;
}
//權限
try{
$perm = $facebook->api(array(
'method' => 'fql.query',
'query' => 'select user_photos from permissions where uid='.$fb_id
));
if( $perm[0]['user_photos'] != '1' ){
$url = $facebook->getLoginUrl($aLoginParam);
header('Location: '.$url); exit;
}
}catch (Exception $e) { }
//取得封面的
try{
$aAlbum = $facebook->api(array(
'method' => 'fql.query',
'query' => 'select aid,name,cover_pid from album where owner='.$fb_id
));
}catch(Exception $e){ }
$aId = array();
foreach( $aAlbum as $k => $v ){
$aId[] = $v['aid'];
}
//取得封面圖片路徑
try{
$aPhoto = $facebook->api(array(
'method' => 'fql.query',
'query' => 'select pid,src_big from photo where pid in(select cover_pid from album where owner='.$fb_id.')'
));
}catch(Exception $e){ }
$aCover = array();
foreach( $aPhoto as $k => $v ){
$aCover[$v['pid']] = $v['src_big'];
}
foreach( $aAlbum as $k => $v ){
$aAlbum[$k]['cover_src'] = $aCover[$aAlbum[$k]['cover_pid']];
}
var_dump($aAlbum);
<?php
$appid = '117616504920787';
$name = '這是測試';
$link = 'http://'.$server.'/test/?link=1';
$redir = 'http://'.$server.'/test/?link=2';
$to = '100000514502035';
$desc = '敘述';
$img = '圖片';
$dir = 'http://www.facebook.com/dialog/send?';
$dir .= 'app_id='.$appid;
$dir .= '&name='.urlencode($name);
$dir .= '&link='.urlencode($link);
$dir .= '&description='.urlencode($desc);
$dir .= '&picture='.urlencode($img);
$dir .= '&to='.urlencode($to);
$dir .= '&redirect_uri='.urlencode($redir);
header('Location: '.$dir); exit;
?>
var map;
var infowindow;
function checkin(id,lat,lng){ //打卡
$.get('facebook_checkin.php',{'id':id,'lat':lat,'lng':lng},function(o){
alert(o);
});
}
function infoWindow(lat,lng){
if( infowindow ){ //關閉上一個對話框
infowindow.close();
}
var place_content = '點選下列地點後打卡<br>';
$.get('facebook_place.php',{'lat':lat,'long':lng},function(o){
for( var i=0; i<o.length; i++ ){ //可打卡地點
if(o[i].name!=undefined){
place_content += '<a href="javascript:checkin('+o[i].id+','+lat+','+lng+');">'+o[i].name+'</a><br>';
}
}
infowindow = new google.maps.InfoWindow(
{ content: place_content,
size: new google.maps.Size(50,50),
position: new google.maps.LatLng(lat,lng)
});
infowindow.open(map);
});
}
function map_init(){ //google map
var myLatlng = new google.maps.LatLng(25.047795,121.516900);
var myOptions = {
zoom: 12,
center: myLatlng,
streetViewControl: false,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
google.maps.event.addListener(map, 'click', function(event) {
var lat = event.latLng.Ia;
var lng = event.latLng.Ja;
infoWindow(lat,lng);
});
}
$(document).ready(function(){
$('#map_canvas').css({height:$(window).height()*0.8,width:$(window).width()});
map_init();
});