我使用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。我希望爆炸函数创建3个数组项,将字符串拆分为‘'>’‘.
但结果是:
array (size=1)
0 => string 'E-commerce consultant>man>het e-commerce' (length=46)似乎它确实将字符串放入数组中,但只创建了一行.
发布于 2016-04-08 07:45:33
而不是> char,而是实体>。你可以通过这个实体字符串爆炸:
$author_desc = get_the_author_meta('description');
$author_data = explode('>', $author_desc); // explode by > instead of >
var_dump($author_data);https://stackoverflow.com/questions/36494156
复制相似问题