Php 如何使用变量输入数组项?(菲律宾)
如果要创建阵列,请执行以下操作:Php 如何使用变量输入数组项?(菲律宾),php,Php,如果要创建阵列,请执行以下操作: $tem='12,13,14,15'; $arr = array($tem); //which is wrong 而不是: $arr = array(12,13,14,15); 我该怎么办?始终存在语法错误。我不确定您为什么要这样做: $tem='12,13,14,15'; $arr = explode(',', $tem); 您好,您不能以这种方式添加多个条目。尝试分解字符串,然后使用foreach循环遍历生成的数组。
$tem='12,13,14,15';
$arr = array($tem); //which is wrong
而不是:
$arr = array(12,13,14,15);
我该怎么办?始终存在语法错误。我不确定您为什么要这样做:
$tem='12,13,14,15';
$arr = explode(',', $tem);
您好,您不能以这种方式添加多个条目。尝试分解字符串,然后使用foreach循环遍历生成的数组。