【发布时间】:2016-07-29 09:30:03
【问题描述】:
我正在使用get_the_author_meta('description') 函数通过以下代码在 WordPress 中获取作者描述:
$author_desc = get_the_author_meta('description');
$author_data = explode('>', $author_desc);
var_dump($author_data);
描述为:E-commerce consultant>man>het e-commerce。我希望explode函数创建3个数组项,用'>'分割字符串。
但是结果是这样的:
array (size=1)
0 => string 'E-commerce consultant>man>het e-commerce' (length=46)
似乎它确实将字符串放入了一个数组中,但只创建了一行...
【问题讨论】:
-
也许用str_replace将>替换成另一组字符,比如
,然后用
展开。
标签: php arrays wordpress explode