This article shares with you how to output js statements in PHP. Friends in need can refer to it
Example
php<?php $classState=""; if($state==0){ $classState="已下课"; } else{ $classState="正在上课"; } echo "<script type='text/javascript'> function getState(){ var cs = ".$state."; return cs; } </script>"; ?>
In this way, you can directly reference the js method output in php in other places on the page.
The above is the detailed content of Output js statements in php - Blue Moon. For more information, please follow other related articles on the PHP Chinese website!