ここにいくつかの方法があります:
方法1:
<?php
$expression = isset($GLOBALS['_url']) ? htmlspecialchars($GLOBALS['_url']) : '';
echo "
<input type='text' value='$expression' />
";
?>
方法2:
<?php
$expression = isset($GLOBALS['_url']) ? htmlspecialchars($GLOBALS['_url']) : '';
echo "
<input type='text' value='" . $expression . "' />
";
?>
方法3:
<?php
echo "
<input type='text' value='" . isset($GLOBALS['_url']) ? htmlspecialchars($GLOBALS['_url']) : '' . "' />
";
?>
更新:
方法4:PHPによる処理が高速であるため、方法4または5のいずれかを使用します。ここでの変更は、二重引用符ではなく一重引用符を使用していることです。
<?php
echo '
<input type="text" value="' . isset($GLOBALS['_url']) ? htmlspecialchars($GLOBALS['_url']) : '' . '" />
';
?>
方法5:
<?php
$expression = isset($GLOBALS['_url']) ? htmlspecialchars($GLOBALS['_url']) : '';
echo '
<input type="text" value="' . $expression . '" />
';
?>