<!DOCTYPE html>
<html>
<body>
<?php
$x = " Hello World! ";
echo trim($x);
?>
<p>空格在纯 HTML 中是不可见的,<br>
但请查看两个输入字段中的区别:</p>
echo "<input value='" . $x . "'>";
echo "<br>";
echo "<input value='" . trim($x) . "'>";
</body>
</html>