如下:
 <html>
 <script type="text/javascript" src="js/jquery-min.js"></script>
 <input type="button" value="submit" id="submit" />
<?php 
 $_stable='wo';
 $year='2012';
 echo <<<DRR
 <script type="text/javascript">
   var w=screen.width;
   $("#submit").click(function(){
    $.post("modules/auto.php",{action:"ac",stable:$_stable,year:$year},function(data){
 
      });
   });
   //alert(w);
 </script>
DRR;
?>
</html>
总是提示wo未定义,但是将$_table改成数字就没问题,什么原因,怎么解决?新手,谢谢

解决方案 »

  1.   

    $.post("modules/auto.php",{action:"ac",stable:'"'.$_stable.'"',year:$year},function(data){
      

  2.   

    $.post("modules/auto.php",{action:"ac",stable:'$_stable',year:$year},function(data){
      

  3.   

    $.post("modules/auto.php",{action:"ac",stable:'$_stable',year:$year},function(data){
      

  4.   

    按照heredoc,只用加上双引号就可以了。为什么会出现这种情况呢?数字型就没问题