Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在研究柔道俱乐部的注册系统。我正在使用一个字符串来存储出现的人的 ID。它看起来像这样:
0,3,4,7,8,10,
现在,我想在 PHP 中将每个数字分成一个整数数组。最简单的解决方案是什么?:)
采用explode()
explode()
$ids = explode(',', '0,3,4,7,8,10');
$str = '0,3,4,7,8,10'; $arr = explode(',',$str);
采用EXPLODE
EXPLODE
$num = "0,3,4,7,8,10"; $pieces = explode(",", $num );