Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用一个使用 JSON 数组绘制时间线的库。
是否可以通过 PHP 创建一个 JSON 对象以在页面加载时与该库一起使用?如果是,我该怎么做?
当然。只需将对象回显到页面上:
<script type="text/javascript"> <?php echo 'var yourObj = ', json_encode($yourObject), ';'; ?> </script>