I want to echo some HTML from PHP that contains a link that has the text '<<< Back' on it. I can't get the '<<<' to display properly.
Anybody have any ideas? This is my current code:
$paginationDisplay .= ' <span class="paginationNumbersbn"> <a href="' . $_SERVER['PHP_SELF'] . '?pn=' . $previous . '"> '<<<'Back</a></span> ';
If you want to display a literal less-than sign, encode it as <
as per the HTML spec.
You might also want to look into another related entity: «
. This produces a double left angle quote:
«
You don't need to escape it, as it has nothing to do with PHP.
Often websites just print out <, instead of using the appropriate HTML entity.
Try the following:
$paginationDisplay .= ' <span class="paginationNumbersbn"> <a href="' . $_SERVER['PHP_SELF'] . '?pn=' . $previous . '"> <<<Back</a></span> ';
$paginationDisplay .= ' <span class="paginationNumbersbn"> <a href="' . $_SERVER['PHP_SELF'] . '?pn=' . $previous . '"><<<Back</a></span>';
<
= < >
= >
You can use these and many other HTML entities to put symbols like this into your page.
It doesn't work properly because PHP attaches a special meaning to <<< called HEREDOC. You are better off encoding each < as <
and then displaying it as the others suggested.
http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.