ysy950803 2018-09-15 14:59:11

用img标签实现异步执行代码

// 先把相关任务写在一个php文件里
<?php
$con = new mysqli('xxx.xxx.xxx.xxx', 'root', '123456', 'db_name');
// ...
$con -> query($sql);
$con -> close();
// ...
?>
// 然后在html中这样写,就能异步跑了,不会阻塞页面加载
<img src="crwd.php" border="0" style="display:none;"/>

评论

Home - Wiki
Copyright © 2011-2024 iteam. Current version is 2.139.0. UTC+08:00, 2024-12-22 16:25
浙ICP备14020137号-1 $Map of visitor$