我的PHP代码中出现意外的T_DOUBLE_ARROW错误

时间:2014-01-15 13:47:57

标签: php error-handling syntax-error

我确信这很简单,但我的代码下面出现unexpected T_DOUBLE_ARROW语法错误。有人可以帮我解决问题吗?

由于

大须

// Set timezone
date_default_timezone_set('Australia/Melbourne'); 

// Set timestamps to compare
$tts                        = date('Y-m-d h:i:s');      // Today's timestamp
$fts                        = '2014-29-01 12:00:00';    // Final 'end' timestamp
$fts24                      = '2014-28-01 12:00:00';    // Last 24 hours timestamp

// Set conditions
$show24                     = false;
$show                       = false;

    // $tts must be between $fts24 and $fts
    if( $tts => $fts24 && $tts =< $fts ) {
        $show24 = true;
    }
    // $show24 must be false (don't show last 24 hours banner) and $tts must be before $fts
    if( $show24 == false && $tts =< $fts ) {
        $show = true;
    }

// Show either general or last 24hrs banner
if($show24) : ?>

    <a href="#url1" id="banner">
        <img src="<?php bloginfo('stylesheet_directory'); ?>/images/image24.jpg" alt="image" width="500" height="62" />
    </a>

<?php elseif($show): ?>

    <a href="#url2" id="banner">
        <img src="<?php bloginfo('stylesheet_directory'); ?>/images/image.jpg" alt="image" width="500" height="62" />
    </a>

<?php endif; ?>

1 个答案:

答案 0 :(得分:4)

就在这里:

if( $tts => $fts24 && $tts =< $fts ) {

将其更改为:

if( $tts >= $fts24 && $tts <= $fts ) {

如果您将来遇到同样的错误,您会发现通过搜索代码(Ctrl + F)获取“=&gt;”非常容易或“=&lt;”外观