【问题标题】:ASCII text art logo not displaying properly in PHP. (noob coder)ASCII 文本艺术徽标在 PHP 中无法正确显示。 (菜鸟编码器)
【发布时间】:2019-04-29 14:12:33
【问题描述】:

我正在尝试为我的 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

【问题讨论】:

    标签: php text ascii


    【解决方案1】:

    你正在做相反的事情。 首先分配 $asciiart 变量, 并在它回响之后。

    所以你的代码应该是:

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

    【讨论】:

    • 感谢您解决此问题。我将它添加到 index.php 但它破坏了文件,我只得到一个空白屏幕。如何从头开始制作新的 index.php 以在 php 中自行测试此代码?
    • 我尝试在sandbox.onlinephpfunctions.com 上测试代码,但它不起作用 :( 它给了我“解析错误:语法错误,意外”
    • 现在试试,我打错了 php 结束标签,'?>' 如果你想让 index.php 在 html 标签周围工作。从这里w3schools.com/tags/tag_doctype.asp复制代码,并将php代码放在body中。
    猜你喜欢
    • 1970-01-01
    • 2012-01-25
    • 2012-07-08
    • 1970-01-01
    • 1970-01-01
    • 2016-06-21
    • 2013-06-27
    • 1970-01-01
    • 2021-12-19
    相关资源
    最近更新 更多