FB.ui( { method: 'feed', name: "Sit-Ups Won’t", link: "https://xxx/", picture: "http://xxx/shutterstock_119588920-2xpj7nxhm0d9jws3k56zuo.jpg", description: "I am often asked if doing situps or crunches will get people the toned six-pack abs they're looki..." }, function....
其中description在php中是直接echo文章的內容,但這字串含斷行符號,一直出現“Unexpected token ILLEGAL”,使用str_replace去取代\r或\n都無效,查了這篇PHP: 移除換行符號,最後使用
echo preg_replace('/\v/', '', $description);
就解決了
參考網址:
PHP: 移除換行符號