简体   繁体   English

Python 打印出 PHP 代码

[英]Python printing out PHP code

Just out of curiosity, I know it's possible having a HTML web page fully printed out in Python, such as:出于好奇,我知道可以在 Python 中完全打印出 HTML 网页,例如:

print 'Content-type: html\n\n'
print '<html>'
print '<head><title>My first Python CGI app</title></head>'
print '<body>'
print '<p>Hello, world!</p>'
print '</body>'
print '</html>'

Is it also possible to do something similiar with PHP?是否也可以做一些与 PHP 类似的事情?

print """
<?php
   $wtfs = array("what", "the", "freak", "is", "this", "shnitz");
   echo "<ul>\n";
   foreach($wtfs as $wtf) {
       echo "<li>$wtf</li>\n";
   }
   echo "<li>???</li>\n";
   echo "</ul>\n";
?>
""" 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM