<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Schedule of all</title> <link rel="stylesheet" href="./js/fullcalendar.min.css"> <script src="./js/jquery.min.js"></script> <script src="./js/moment.min.js"></script> <script src="./js/fullcalendar.min.js"></script> </head> <body> <div id="calendar"></div> </body> <script> $(document).ready(function() { $('#calendar').fullCalendar({ header: { left: 'prev,next today', center: 'title', right: 'month,agendaWeek,agendaDay' }, defaultDate: new Date(), navLinks: true, // can click day/week names to navigate views editable: true, eventLimit: true, // allow "more" link when too many events events: 'event.php' }); }); </script> </html>用类似的代码实现PHP前端显示日历
时间: 2023-08-14 09:37:24 浏览: 448
js实现的日历显示-calendar.html
4星 · 用户满意度95%
要用PHP代码实现前端显示日历,您需要将代码保存为.php文件,并在文件中包含PHP和HTML代码。以下是一个例子:
```
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Schedule of all</title>
<link rel="stylesheet" href="./js/fullcalendar.min.css">
<script src="./js/jquery.min.js"></script>
<script src="./js/moment.min.js"></script>
<script src="./js/fullcalendar.min.js"></script>
</head>
<body>
<div id="calendar"></div>
<?php
echo "<script>
$(document).ready(function() {
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
defaultDate: new Date(),
navLinks: true, // can click day/week names to navigate views
editable: true,
eventLimit: true, // allow 'more' link when too many events
events: 'event.php'
});
});
</script>";
?>
</body>
</html>
```
在这个例子中,我们将JavaScript代码嵌入到echo语句中,并使用双引号将JavaScript代码括起来。这样,我们就可以在PHP文件中执行JavaScript代码,实现动态的日历功能。同时将其保存为.php文件,就可以在服务器上执行PHP代码并显示日历了。
阅读全文