<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head>? ? <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />? ? <title>Document</title></head><body><?phpecho "<meta charset='utf-8'>";$d=scandir("./");echo "<table width='600' border='1'>? ? ? ? ? ? <tr>? ? ? ? ? ? ? ? <td>id號</td>? ? ? ? ? ? ? ? <td>文件名</td>? ? ? ? ? ? ? ? <td>編輯</td>? ? ? ? ? ? </tr>";for($i=2,$bb=count($d);$i<$bb;$i++){? ? echo "<tr>? ? ? ? ? ? ? ? <td>".$i."</td>? ? ? ? ? ? ? ? <td>".$d[$i]."</td>? ? ? ? ? ? ? ? <td>? ? ? ? ? ? ? ? ? ? <a href='./index.php?mz=".$i."' onclick='ounis()'>刪除</a>? ? ? ? ? ? ? ? </td>? ? ? ? ? ? </tr>";}echo "</table>";?><script>function ounis(){? ? if(confirm('確認刪除嗎')){? ? <?php? ? ? ? if(isset($_GET['mz']) && !empty($_GET['mz'])){? ? ? ? if(is_dir($d[$_GET['mz']])){? ? ? ? ? ? rmdir($d[$_GET['mz']]);? ? ? ? ? ? header('Refresh: 1; url=./');? ? ? ? }else{? ? ? ? ? ? unlink($d[$_GET['mz']]);? ? ? ? ? ? header('Refresh: 0; url=./');? ? ? ? };? ? ? ? };? ? ?>? ??? ? }else{? ? ? ? alert('message');? ? };};</script><!-- <script>? ? function iii(){? ? ? ? if(confirm('確認刪除嗎')){? ? ? ? <?php ounis()?>? ? }else{? ? ? ? alert('你取消了刪除');location.href='./genggai.php';? ? }? ? }</script> --></body></html>
js 如何調用 php
hhhzihao2
2016-03-29 20:27:57