2016-04-14 48 views
-1

我想说明一个JavaScript函数* *外的标签和,里面的标签工作,但我需要了出来。秀功能的JavaScript在PHP

如何通过?在WordPress

我的代码PHP:

function custom_shortcode3() { 
    $conecta3 = mysql_connect("localhost", "mcommerce", "kaishek") or print (mysql_error()); 
    mysql_select_db("mcommerc_whmcs", $conecta3) or print(mysql_error()); 
    function mysql_get_var3($query,$y=0){ 
      $res = mysql_query($query); 
      $row = mysql_fetch_array($res); 
      mysql_free_result($res); 
      $rec = $row[$y]; 
      return $rec; 

    } 
    ?> 
    <html> 
     <div id="show"></div> 

     <script type="text/javascript" src="jquery.js"></script> 

     <script type="text/javascript"> 

          function total() { 
       setInterval(function() { 
        $('#show').load('datatotaldeprodutos.php') 
       }, 1000); 
      }; 
     <? 
    echo "total();"; //WORK BUT NOT APPEAR IN WORDPRESS 
?> 
     </script> 
    </html> 
    <? 
    echo "total();"; //NOT WORKKK 
    echo "test"; //WORK, APPEAR IN WORDPRESS. i need the function appear 
    } 
add_shortcode('totaldeprodutos', 'custom_shortcode3'); 
+3

_ * outside * the tags_?那是什么意思 ? – Rayon

+0

echo“total();”;在标签