ASCII文本艺术徽标在PHP中无法正常显示。 (noob编码器)

问题描述 投票:0回答:1

我正在尝试为我的YOURLS网站index.php添加这个ascii art徽标:

<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

php text ascii
1个回答
1
投票

你正在逆转。首先分配$ asciiart变量,然后回显出来。

所以你的代码应该是:

<?php $asciiart = '......'; ?>
<pre style="font-family: 'Courier New', Courier, monospace"><?php echo 
$asciiart; ?></pre>
© www.soinside.com 2019 - 2024. All rights reserved.