Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/string/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何通过在php中连接字符串在php中添加换行符_Php_String_Concat_Line Breaks - Fatal编程技术网

如何通过在php中连接字符串在php中添加换行符

如何通过在php中连接字符串在php中添加换行符,php,string,concat,line-breaks,Php,String,Concat,Line Breaks,我试图在连接一些字符串时添加换行符,但这对我不起作用。 我已经用“\n”和PHP\u EOL函数完成了,什么都没有 $data = $data." *Producto ".$aux.":* ".$nombre_producto." *cantidad:* ".$cantidad." *precio:* ".$precio_subtotal."".PHP_EOL; 这行代码在for中,根据数组中

我试图在连接一些字符串时添加换行符,但这对我不起作用。 我已经用“\n”和PHP\u EOL函数完成了,什么都没有

 $data = $data." *Producto ".$aux.":* ".$nombre_producto." *cantidad:* ".$cantidad." *precio:* ".$precio_subtotal."".PHP_EOL;

这行代码在for中,根据数组中的产品数量添加连接文本字符串

谢谢大家,我已经修复了它,在每个连接的末尾添加了“%0a:)

查看HTML源代码,您(可能)会看到换行符在那里。如果你想“看到”屏幕上每一行的换行符,你需要使用

或类似的HTML标记。是的,但问题是我正在将这些信息发送到WhatsApp API,当我打印它时,它没有换行符。PS:你可以使用
$data.=“更多”而不是执行
$data=$data.“更多”