Perl-> PHP-> HTML + JavaScript,105个字符
我想使某种语言链有意义,所以我想写一个PHP脚本来生成包含JavaScript的HTML页面。对于第三种语言,我选择Perl是因为我喜欢Perl。:)
有人可能会考虑这四种语言,但是在这里,我并没有真正将HTML与JavaScript分开-它是一种标记语言,而不是编程语言。无论如何,这是三个版本:
Perl(105个字符):
printf+(q(<script>alert(unescape("<?=urlencode(<<<E%sprintf+(q(%s),$/)x2,$/%sE%s)?>"))</script>),$/)x2,$/
PHP(165个字符):
<script>alert(unescape("<?=urlencode(<<<E
printf+(q(<script>alert(unescape("<?=urlencode(<<<E%sprintf+(q(%s),$/)x2,$/%sE%s)?>"))</script>),$/)x2,$/
E
)?>"))</script>
HTML + JavaScript(235个字符):
<script>alert(unescape("printf%2B%28q%28%3Cscript%3Ealert%28unescape%28%22%3C%3F%3Durlencode%28%3C%3C%3CE%25sprintf%2B%28q%28%25s%29%2C%24%2F%29x2%2C%24%2F%25sE%25s%29%3F%3E%22%29%29%3C%2Fscript%3E%29%2C%24%2F%29x2%2C%24%2F"))</script>
(Ps。是的,我知道我可以使PHP一步几乎完成,例如仅在Perl中生成HTML + JS代码并将其追加<?php
,但是那感觉太像作弊了。在这种解决方案中,代码实际上是用PHP处理,而不是逐字复制。)