输入banner图图片脚本导航/分类

php中输出js语句-BlueMoon

这篇文章给大家分享的是关于如何在PHP中输出js语句,有需要的朋友可以参考一下

怎样在php中输出js语句?

示例

php<?php
$classState="";

if($state==0){
$classState="已下课";
}
else{
$classState="正在上课";
}

echo "<script  type='text/javascript'>
function getState(){            
        var cs = ".$state.";
        return cs;
} 
</script>";

?>

这样在页面的其他地方,就可以直接引用php中输出的js方法了.

以上就是php中输出js语句 - Blue Moon 的详细内容,更多请关注Gxl网其它相关文章!