Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.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中分解texarea值?_Php_Explode - Fatal编程技术网

如何在php中分解texarea值?

如何在php中分解texarea值?,php,explode,Php,Explode,我从一个文本区域获得post值,如下所示: 11223344 55667788 99001122 33445566 77889900 我需要像这样形成它 Array ( [0] => 11223344 [1] => 55667788 [2] => 99001122 [3] => 33445566 [4] => 11223344 [5] => 77889900 ) 在php中使用explode()函数。怎么可能

我从一个文本区域获得post值,如下所示:

11223344
55667788
99001122
33445566
77889900
我需要像这样形成它

Array
(
    [0] => 11223344
    [1] => 55667788
    [2] => 99001122
    [3] => 33445566
    [4] => 11223344
    [5] => 77889900
)
在php中使用
explode()
函数。怎么可能呢? 我已经使用了
explode('\n\r',$datas)

谢谢

您应该使用双引号而不是单引号:

print_r( explode("\n", $datas) );
使用:


尝试下一步:

print_r(preg_split('/\r\n|[\r\n]/', $_POST['thetextarea']));
使用双引号:

请尝试
“\n\r”
(双引号)或仅
“\n”


当您使用
'\n\r'
时,它意味着搜索
\n\r
并对其进行分解。它不会搜索换行或回车。当您使用双引号时,它将解析换行符或回车符。

请尝试使用
\r\n
或仅使用
\n
“\n\r'
是单引号不会成为换行符和回车符。而且它通常是以完全相反的顺序出现的。谢谢格拉维奇,它对我有用。。。。
print_r(preg_split('/\r\n|[\r\n]/', $_POST['thetextarea']));