数组x
Array
(
    [0] => ,title='测试上窜',titlepic='/ukinfo/d/file/house/other/2011-04-18/small97207890060e54843633227589c40db11303110292.jpg',smalltext='大师傅撒法撒法斯柯达发啊的',batype='住宅买卖',expire='2011-06-17',intro=''
    [3] => ,contact='戴先生',email='[email protected]',phone='01133435800',qq='17589636'
    [4] => 1
)使用 parse_str(str_replace(",", "&", $x[0]), $ar);得到的$ar(请忽略上下内容的不一致)Array
(
    [title] => \'dsfafdasfda\'
    [titlepic] => \'/ukinfo/d/file/house/other/2011-04-19/smalld43d1cf05dde58234ff3d37e837fb6191303179196.jpg\'
    [smalltext] => \'sdfasfsafa\'
    [batype] => \'住宅买卖\'
    [expire] => \'2011-06-18\'
    [intro] => \'\'
)用stripslashes$artp=stripslashes($ar[titlepic]);
echo $artp; //无论$ar[titlepic]是否有值都显示为''

解决方案 »

  1.   

    其实对于你的应用,那些单引号都是应该去掉的$s = ",title='测试上窜',titlepic='/ukinfo/d/file/house/other/2011-04-18/small97207890060e54843633227589c40db11303110292.jpg',smalltext='大师傅撒法撒法斯柯达发啊的',batype='住宅买卖',expire='2011-06-17',intro=''";parse_str(preg_replace(array("/,/", "/'/"), array("&", ""), $s), $ar);print_r($ar);
    Array
    (
        [title] => 测试上窜
        [titlepic] => /ukinfo/d/file/house/other/2011-04-18/small97207890060e54843633227589c40db11303110292.jpg
        [smalltext] => 大师傅撒法撒法斯柯达发啊的
        [batype] => 住宅买卖
        [expire] => 2011-06-17
        [intro] => 
    )