简体   繁体   中英

Facebook Graph Api - writing new lines in PHP

I'm getting an event using Facebook Graph API and PHP using the following code:

$id = '160307307413666';
$FBpage = file_get_contents('https://graph.facebook.com/'. $id);
$FBdata = json_decode($FBpage);
echo $FBdata->description;

The problem is when using json_decode($FBpage); i loose all the /n (new line) that i would like to render.

Any help would be appreciated

i assume you're looking for

echo '<pre>';
echo $FBdata->description;
echo '</pre>';

使用此功能nl2br会将所有新行\\n转换为<br/>标记

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM