<?php $db = new PDO("mysql:host=localhost;dbname=album", 'root', ''); $db->query("set names gb2312"); $sql="SELECT * FROM `sales`"; $rows = $db->query($sql)->fetchall(); foreach($rows as $row) { $str = $row['detail']; preg_match("/[".chr(0xa1)."-".chr(0xff)."]{4}市/",$str,$regs); echo $regs[0]?$regs[0]:'暂无'; echo "<br>"; } ?>