如何将css应用于php’echo $tube-> error;’?

我试图附加到’echo $tube->错误;’的CSS没有显示..它只显示为默认的黑色文本,好像它没有CSS …我将如何解决这个问题?

谢谢 (:

以下是我需要解决的问题..

html / php部分:

<div id="error">
        <pre>
        <?php } else {

        echo $tube->error;

        }
    }
        ?>
    </pre>
</div>

上下文中的html / php部分:

<?php

if(isset($_POST['url']))
{
  include('curl.php');
  include('youtube.php');

  $tube = new youtube();

  $links = $tube->get($_POST['url']);

  if($links) { ?>

  <div id="result"> 
  <b>Download Links  ( Same IP Downloading only )</b> :
        <?php
        $format = '<p><a href="%3$s">Download</a> video.%s - %s<br/>Right-click download link and choose etc...</p>';
        while($link = array_shift($links))
{
    echo vsprintf($format,$link);
}
        ?>
  </div>
  <div id="error">
        <pre>
        <?php } else {

        echo $tube->error;

        }
    }
        ?>
    </pre>
</div>

CSS:

#error {
    width:404px;
    margin-left: auto;
    margin-right: auto;
    font-size:12;
    font-family: 'Dosis', sans-serif;
    color:white;
    padding-top:20px;   
}

youtube.php的一部分(附加信息..不确定你们是否需要这个):

function get($url)
{
    $this->conn = new Curl('youtube');

    $html = $this->conn->get($url);

    if(strstr($html,'verify-age-thumb'))
    {
        $this->error = "Adult Video Detected";
        return false;
    }

    if(strstr($html,'das_captcha'))
    {
        $this->error = "Captcah Found please run on diffrent server";
        return false;
    }

    if(!preg_match('/stream_map=(.[^&]*?)&/i',$html,$match))
    {
        $this->error = "Error Locating Downlod URL's";
        return false;
    }

再次感谢任何帮助!!

解决方法:

试试这段代码:

<?php
if (isset($_POST['url'])) {
    include('curl.php');
    include('youtube.php');

    $tube = new youtube();

    $links = $tube->get($_POST['url']);

    if ($links) {
?>
<div id="result"> 
<b>Download Links  ( Same IP Downloading only )</b> :
<?php
    $format = '<p><a href="%3$s">Download</a> video.%s - %s<br/>Right-click download link and choose etc...</p>';
    while($link = array_shift($links)) {
        echo vsprintf($format,$link);
    }
?>
</div>
<?php } else { ?>
<div id="error">
    <pre>
    <?php echo $tube->error; ?>
    </pre>
</div>
<?php } } ?>

不要忘记包含CSS …并且请将来写得更具可读性.

上一篇:Android Studio 去除上方标题


下一篇:webpack之给目录起别名