在WordPress编辑器中,以下代码对我来说有点不同:
案例 #1
this is a test
案例 #2
this is a test
第一种情况将在句子后添加一个空格,#2 情况将在句子下方留下一个空行。
现在我正在编写一个 PHP,它将在 PHP 字符串中包含 html 代码,
$post_content = "...."
如何区分此 $post_content 变量中的上述两种情况?
如果我写
$post_content += "this is a test";
$post_content += " ";
是拳头案,#2案怎么写?
换行符由"'"表示:
$post_content += "this is a test'n ";
$post_content += "this is a test'n";
$post_content += " ";
区别是换行符。你用'n
表示它 在 PHP 中你这样做
$str = "This is a string.'nThis is the second line.";
在您的情况下
$post_content = "this is a test'n ";