【发布时间】:2021-05-15 14:57:09
【问题描述】:
如果我有字符串:
$_GET['string'] = 'array(1, 2, 3, 4, 5, "My friend Pol, Lucas and Pil", \'HTML without JS, CSS, PHP, JSP or others languages is ...\', 1, 2, 3)';
我如何在你的“LOGICS”值中划分这个字符串:
1
2
3
4
5
"My friend Pol, Lucas and Pil"
'HTML without JS, CSS, PHP, JSP or others languages is ...'
1
2
3
这个失败:
preg_split('/\'.*\'|".*"/', $STRING, PREG_SPLIT_DELIM_CAPTURE);
逻辑上
explode(',', $_GET['string'])
还有
还有更多:如果 STRING 代表一个 ARRAY 多维呢?
【问题讨论】:
-
为什么
$_GET['string']会包含一个php 数组?您没有使用像 $_GET['string'] = '[1,2,3]' 这样的 JSON 数组是否有特定原因? -
感谢@MaartenDev 值来自 READ FILES of CONFIG: (config.php)
-
那么为什么不使用包含/要求呢?