简单,是吧?嗯,这是行不通的:-\

$skuList = explode('\n\r', $_POST['skuList']);

当前回答

你试过用双引号吗?

其他回答

try

explode(chr(10), $_POST['skuList']);

这个方法对我来说总是有效的:

$uniquepattern="@#$;?:~#abcz"//Any set of characters which you dont expect to be present in user input $_POST['skuList'] better use atleast 32 charecters.
$skuList=explode($uniquepattern,str_replace("\r","",str_replace("\n",$uniquepattern,$_POST['skuList'])));

把\n放在双引号中:

explode(“\n”, $_POST['skuList']);

在单引号中,如果我没有记错的话,它被分别视为\和n。

你试过用双引号吗?

看起来很简单

$skuList = explode('\\n', $_POST['skuList']);

你只需要传递准确的文本“\n”,直接写“\n”被用作转义序列。输入"\\"传递一个简单的反斜杠然后输入"n"