0
<input type="submit" value="<? get_the_category($id)[0]->name == 'English' ? echo 'Find' : echo 'encontrar'; ?>">
ここで私の問題は何か分かりませんが、if else conditionの略語をしています。他にPHPで短手が失敗した場合
<input type="submit" value="<? get_the_category($id)[0]->name == 'English' ? echo 'Find' : echo 'encontrar'; ?>">
ここで私の問題は何か分かりませんが、if else conditionの略語をしています。他にPHPで短手が失敗した場合
戻り値の型がないので、echoを使用できないように注意してください。
あなたはこれらのいずれかを試すことができます。
<?php echo (get_the_category($id)[0]->name == 'English') ? 'Find' : 'encontrar'; ?>
OR
<? get_the_category($id)[0]->name == 'English' ? print 'Find' : print 'encontrar'; ?>
三項演算子:http://php.net/manual/en/language.operators.comparison.php#language .operators.comparison.ternaryは式に評価されます。だからちょうど 'エコー'を三元の先頭に置き、三元語の中でそれらを取り除くだけです。 – Rizier123
'? : '' – rmondesilva