簡體   English   中英

PHP 5.3.3 _server ['query_string']錯誤

[英]PHP 5.3.3 _server['query_string'] ERROR

我在PHP服務器5.3.3上使用wordpress,當我嘗試獲取$_SERVER['QUERY_STRING']時出現錯誤。

我的代碼如下:

$query_string = $_SERVER['QUERY_STRING'];     

if($current_user->user_nicename == "admin"){
    echo '<a class="button add_to_cart_button product_type_simple" href="#" target="_blank" >Lista cursos</a>';
      if(isset($_GET['demo'])){ 
          if (strpos($query_string,'&demo') !== false)
            $enlacesindemo = str_replace("&demo","",$query_string);
      }
}
?>
        <a  class="button add_to_cart_button product_type_simple" href="index.php?<?= $enlacesindemo ?>" target="_self">Ver todos</a>

我得到這個作為鏈接:

index.php?<?= $query_string ?>&demo

服務器未啟用short_open_tags

嘗試使用<?php ?>代替<? ?> <? ?>

<?php echo $variable;?>而不是<?=$variable;?>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM