$d = ‘$Row=10 $cid=1 $table=channel $sql=select * form abc $Where=[FatherID]=0 $’
preg_match_all('/\$(\w+)=(.+?) \$/i', $d, $matches2);
if($matches2){
$d2 = '';
for($k=0;$k
}
}
结果 只有 Row="10" table="channel" Where="[FatherID]=0"
应该是 Row="10" cid="1" table="channel" $sql="select * form abc" Where="[FatherID]=0" 才对呀 错在哪呢?
应该匹配到5个才对呀 为啥只有3个呢 求大神给个解决方案
$d = '$Row=10 $cid=1 $table=channel $sql=select * form abc $Where=[FatherID]=0 $';preg_match_all('/\$(\w+)=([^$]+)/i', $d, $matches2);print_r($matches2);
Array( [0] => Array ( [0] => $Row=10 [1] => $cid=1 [2] => $table=channel [3] => $sql=select * form abc [4] => $Where=[FatherID]=0 ) [1] => Array ( [0] => Row [1] => cid [2] => table [3] => sql [4] => Where ) [2] => Array ( [0] => 10 [1] => 1 [2] => channel [3] => select * form abc [4] => [FatherID]=0 ))
你 /\$(\w+)=(.+?) \$/ 这样写不行的原因是
$Row=10 $cid=1 $table=channel $sql=select * form abc $Where=[FatherID]=0 $
看明白了吗?
用这个规则,你还需要 $d = str_replace('$', '$$', $d),
你 /\$(\w+)=(.+?) \$/ 这样写不行的原因是
$Row=10 $cid=1 $table=channel $sql=select * form abc $Where=[FatherID]=0 $
看明白了吗?
用这个规则,你还需要 $d = str_replace('$', '$$', $d),
你 /\$(\w+)=(.+?) \$/ 这样写不行的原因是
$Row=10 $cid=1 $table=channel $sql=select * form abc $Where=[FatherID]=0 $
看明白了吗?
用这个规则,你还需要 $d = str_replace('$', '$$', $d),