ASCII文字艺术徽标无法在PHP中正确显示。 (菜鸟编码器)

时间:2019-04-29 14:12:34

标签: php text ascii

我正在尝试为我的YOURLS网站index.php添加此ascii艺术徽标:

<pre style="font-family: 'Courier New', Courier, monospace"><?php echo 

$asciiart; ?/></pre>

        $asciiart = '
__/\\\\____________/\\\\__/\\\________/\\\_____/\\\\\\\\\_____/\\\________/\\\________/\\\\____________/\\\\__/\\\\\\\\\\\\\\\_\n        
 _\/\\\\\\________/\\\\\\_\/\\\_____/\\\//____/\\\\\\\\\\\\\__\///\\\____/\\\/________\/\\\\\\________/\\\\\\_\/\\\///////////__\n        
  _\/\\\//\\\____/\\\//\\\_\/\\\__/\\\//______/\\\/////////\\\___\///\\\/\\\/__________\/\\\//\\\____/\\\//\\\_\/\\\_____________\n       
   _\/\\\\///\\\/\\\/_\/\\\_\/\\\\\\//\\\_____\/\\\_______\/\\\_____\///\\\/____________\/\\\\///\\\/\\\/_\/\\\_\/\\\\\\\\\\\_____\n      
    _\/\\\__\///\\\/___\/\\\_\/\\\//_\//\\\____\/\\\\\\\\\\\\\\\_______\/\\\_____________\/\\\__\///\\\/___\/\\\_\/\\\///////______\n    
     _\/\\\____\///_____\/\\\_\/\\\____\//\\\___\/\\\/////////\\\_______\/\\\_____________\/\\\____\///_____\/\\\_\/\\\_____________\n    
      _\/\\\_____________\/\\\_\/\\\_____\//\\\__\/\\\_______\/\\\_______\/\\\_____________\/\\\_____________\/\\\_\/\\\_____________\n   
       _\/\\\_____________\/\\\_\/\\\______\//\\\_\/\\\_______\/\\\_______\/\\\________/\\\_\/\\\_____________\/\\\_\/\\\\\\\\\\\\\\\_\n  
        _\///______________\///__\///________\///__\///________\///________\///________\///__\///______________\///__\///////////////__\n'
 asciiart;

但是它破坏了index.php!它只是显示一个黑屏...我在做什么错了?

在我尝试添加ascii文本徽标之前,这是我index.php的有效源代码...

pastebin of working source code of my modified YOURLS website index.php

1 个答案:

答案 0 :(得分:1)

您正在做相反的事情。 首先分配$ asciiart变量, 然后回声出来。

因此您的代码应为:

<?php $asciiart = '......'; ?>
<pre style="font-family: 'Courier New', Courier, monospace"><?php echo 
$asciiart; ?></pre>