您正在尝试使用以下代码找出如何使用strolower函数和strtolower + str_replace函数 - <?php echo get_the_author_meta('custom_field_35', $user->ID); ?>
这是我到目前为止所做的,但它不起作用 -
<?php
$str = "echo get_the_author_meta('custom_field_35', $user->ID);";
$str = strtolower($str);
echo $str; // Prints mary had a little lamb and she loved it so
?>
<?php $get_the_author_meta('custom_field_36', $user->ID) = strtolower(str_replace(",", "",$get_the_author_meta('custom_field_35', $user->ID))); ?>
如何将strtolower和str_replace与get_the_author_meta一起使用?
答案 0 :(得分:0)
你底部的strtolower和str_replace看起来很好,但是你无法分配给它:
$get_the_author_meta('custom_field_36', $user->ID)
你最好只有:
<?php echo strtolower(str_replace(",", "",$get_the_author_meta('custom_field_35', $user->ID))); ?>
或者将它放入变量并回显:
<?php $var = strtolower(str_replace(",", "",$get_the_author_meta('custom_field_35', $user->ID)));
echo $var; ?>
答案 1 :(得分:0)
好的,好像我不需要回去学习基本的PHP语法规则,我能够自己搞清楚。
如果其他人想知道我是怎么做的 -
<?php
$f_states = get_the_author_meta( 'custom_field_35', $user->ID, true );
$f_pr = get_the_author_meta( 'custom_field_36', $user->ID, true );
?>
<?php Print(strtolower(str_replace(",", "",$f_pr))); ?> <?php Print(strtolower($f_states)); ?>