我目前正在开发一个使用Express(Node.js)构建的应用程序,我想知道处理不同环境(开发,生产)的不同robots.txt的最聪明方法是什么.
这就是我现在所拥有的,但我不相信解决方案,我认为它很脏:
app.get '/robots.txt', (req, res) ->
res.set 'Content-Type', 'text/plain'
if app.settings.env == 'production'
res.send 'User-agent: *\nDisallow: /signin\nDisallow: /signup\nDisallow: /signout\nSitemap: /sitemap.xml'
else
res.send 'User-agent: *\nDisallow: /'
Run Code Online (Sandbox Code Playgroud)
(注意:这是CoffeeScript)
应该有更好的方法.你会怎么做?
谢谢.
当我试图在Facebook Graph API上获得我所有的"喜欢"(以前的粉丝页面)时,有时它会返回一个空集:
{
"data": [
]
}
Run Code Online (Sandbox Code Playgroud)
我尝试使用https://graph.facebook.com/me/likes?access_token=MY_ACCESS_TOKEN和graph.facebook.com/vinch/likes?access_token=MY_ACCESS_TOKEN,但结果完全相同(空).
知道它可能是什么吗?我需要知道用户是否喜欢(是粉丝)特定页面.
我最近发现这篇博文说,可以通过Facebook应用程序(来自API)标记状态更新中的某个人:
但是,它似乎对我不起作用.
它以三种不同的方式尝试了它:
$post = $facebook->api('/me/feed', 'post', array(
'access_token' => $session['access_token'],
'message' => 'Hello @[562372646:Lionel Cordier], how are you?'
));
Run Code Online (Sandbox Code Playgroud)
要么
$access_token = $session['access_token'];
$message = 'Hello @[562372646:Lionel Cordier], how are you?';
$curl_post = 'access_token='.$access_token.'&message='.$message;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://graph.facebook.com/me/feed');
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $curl_post);
$data = curl_exec($ch);
curl_close($ch);
Run Code Online (Sandbox Code Playgroud)
要么
$access_token = $session['access_token'];
$message = 'Hello @[562372646:Lionel Cordier], how are you?';
$curl_post = 'access_token='.$access_token.'&status='.$message;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.facebook.com/method/users.setStatus'); …
Run Code Online (Sandbox Code Playgroud)