0

こんにちは、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))); ?>

get_the_author_meta で strtolower と str_replace を使用するにはどうすればよいですか?

4

2 に答える 2

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)); ?>
于 2013-01-15T04:49:30.990 に答える
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; ?>

于 2013-01-10T16:40:26.030 に答える