分解字符串后,您可以使用以下方式调用单独的分隔词:
$string[0]
$string[1]
等等
有没有办法用通配符一次调用它们。我知道这个例子不起作用,但像这样:
$string[*]
这可能是一个愚蠢的问题;我只是想节省自己必须编写 30 行代码而不是 1 行的代码。
- 编辑 -
这是我现在拥有的对我有用的东西:
$words = explode(' ',$string);
$thestuff = '';
if ($words[0] || $words[1] || $words[2] || $words[3] || $words[4] || $words[5] || $words[6] || $words[7] || $words[8] || $words[9] || $words[10] || $words[11] || $words[12] || $words[13] || $words[14] || $words[15] || $words[16] || $words[17] || $words[18] || $words[19] || $words[20] || $words[21] || $words[22] || $words[23] || $words[24] || $words[25] || $words[26] || $words[27] || $words[28] || $words[29] || $words[30]){
$thestuff = do_shortcode($content);
}
return $thestuff;
}
但我希望能够使用 $words[wildcard] 或更简单的东西来做到这一点。