数组xArray
(
[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
)想要判断数组x[0]中titlepic是否有值。
将x[0]用逗号explode之后得到的数组Array
(
[0] =>
[1] => title='测试上窜'
[2] => titlepic='/ukinfo/d/file/house/other/2011-04-18/small97207890060e54843633227589c40db11303110292.jpg'
[3] => smalltext='大师傅撒法撒法斯柯达发啊的'
[4] => batype='住宅买卖'
[5] => expire='2011-06-17'
[6] => intro=''
)
请问如何判断其中titlepic是否有值呢?即获取titlepic的''之间的值
(
[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
)想要判断数组x[0]中titlepic是否有值。
将x[0]用逗号explode之后得到的数组Array
(
[0] =>
[1] => title='测试上窜'
[2] => titlepic='/ukinfo/d/file/house/other/2011-04-18/small97207890060e54843633227589c40db11303110292.jpg'
[3] => smalltext='大师傅撒法撒法斯柯达发啊的'
[4] => batype='住宅买卖'
[5] => expire='2011-06-17'
[6] => intro=''
)
请问如何判断其中titlepic是否有值呢?即获取titlepic的''之间的值
解决方案 »
- PHP编辑的问题
- 手机支付开发
- asp+access 从数据库读出一个列表,表中有 用户名,年龄等,我想点击“用户名”,就转到这个表的修改页面。
- Windows下IIS6/Apache2.2.4+MySQL5.2+PHP5.2.1安装配置详细单
- 请问下,在PHP中怎样可以获取数据表的列名?
- php 给图片加边框后生成带边框图片
- 数据数(phpmyadmin)为什么老是用不了?
- 如何不通过点提交按钮把来响应提交事件。也就是不用点SUBMIT来把表单的数据传给PHP。(在线等代)
- session不能工作(初学)
- 请问有没有这种软件???
- 正则匹配网页内容,求解谢谢
- 正则限制位数,只能匹配5位的数字,字母。
echo '有值';
}
if (y[1] == "''") echo '空值';
$str = "titlepic='/ukinfo/d/file/house/other/2011-04-18/small97207890060e54843633227589c40db11303110292.jpg'";
$newstr = explode('=', $str);//再分一次
var_dump($newstr[1] == "''");//查看第二个元素值是否等于两个单眼号
这个不行吧?
eval($x[0][2]);//注意:前面是否有$titlepic这个变量,有的话会覆盖
if (!empty($titlepic)) echo '有值';
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);if(! empty($ar['title'])) echo '有值';
为什么我用你的方法得出来的加了反斜杠呢?
Array
(
[title] => \'dsfafdasfda\'
[titlepic] => \'/ukinfo/d/file/house/other/2011-04-19/smalld43d1cf05dde58234ff3d37e837fb6191303179196.jpg\'
[smalltext] => \'sdfasfsafa\'
[batype] => \'住宅买卖\'
[expire] => \'2011-06-18\'
[intro] => \'\'
)
$artp=stripslashes($ar[titlepic]);
echo $artp; //无论$ar[titlepic]是否有值都显示为''怎么取[titlepic]?