In PHP, can i use put echo inside a variable?
This question already has an answer here:
<!DOCTYPE HMTL>
<html>
<head>
</head>
<body>
<?php
echo $javascript = '<script type = "text/javascript">prompt("Hello");</script>';
?>
</body>
</html>
You can simply echo the script using echo (without even using the variable)
<?php
echo '<script type = "text/javascript">prompt("Hello");</script>';
?>
Or Using variable
<?php
echo $javascript = '<script type = "text/javascript">prompt("Hello");</script>';
?>
Or using shorthand
<?='<script type = "text/javascript">prompt("Hello");</script>'?>
链接地址: http://www.djcxy.com/p/59452.html
上一篇: 即使没有缺失的分号。?