date.php

来自「使用PHP和AJAX显示日期」· PHP 代码 · 共 41 行

PHP
41
字号
<?require("ajax.php");function show_now() {	//return server date	return date("l dS of F Y h:i:s A");}$sajax_request_type = "GET";sajax_init();sajax_export("show_now");sajax_handle_client_request();?><html><head>        <title>Show Server's Date</title>        <script>        <?        sajax_show_javascript();        ?>        function show_me(date_server) {                document.getElementById("date_div").innerHTML = date_server;        }        function get_date() {                //put the return of php's show_now func                //to the javascript show_me func as a parameter                x_show_now(show_me);                //do it every 1 second                setTimeout("get_date()", 1000);        }        </script></head><body  onload="get_date();">Server date: <div id="date_div">(loading...)</div></body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?