我有一个 PHP 脚本,可以将故事节点添加到我的 drupal 网站:
function post_to_webpage($title, $body, $teaser, $promote) {
//set the working directory to your Drupal root
chdir($_SERVER["DOCUMENT_ROOT"].'/webpage/');
//require the bootstrap include
require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
//(loads everything, but doesn't render anything)
$node = new stdClass();
$node->type = 'story';
$node->title = $title;
$node->body = $body;
$node->teaser = $teaser;
$node->uid = 1;
$node->status = 1;
$node->promote = $promote;
$node->format = 2;
$node->sticky = 1;
node_save($node);
return $node->nid; }
但是我经常在这些节点的内容中看到 r\n\。什么可能导致这种情况?
编辑:示例输出:
Lorem ipsum dolor sit amet, consectetur adipiscing elit。Sed 前庭 ultrices ultricies。Curabitur nibh risus,mattis rhoncus dignissim vel,laoreet sit amet neque。Praesent blandit arcu et nisl ornare semper。
\r\n
\r\n
Vestibulum eleifend malesuada odio,aliquet mauris sagittis sed。Proin 坐在 sed urna 中的 amet libero quis nibh malesuada mattis。Nullam rutrum egestas interdum。Sed dui lorem, faucibus et sagittis in, volutpat at velit。