-
-
$conn= new PDO("mysql:dbname=lamp;host=localhost","root","123456");
$sql="select id,username,phone,*** from user";
- $pdo=$conn->prepare($sql);
- $pdo->execute();
- $str='';
- $str.='';
- //如果内容中有html代码可以使用
- while(list($id,$username,$phone,$***)=$pdo->fetch(PDO::FETCH_NUM)){
- $str.='';
- $str.=''.$username.'';
- $str.=''.$phone.'';
- $str.='<***>'.$***.'***>';
- $str.='';
- }
$str.='';
- file_put_contents("user.xml",$str);
- header("Content-type:text/xml");
- echo $str;
- ?>
-
复制代码
|