In the following code, I need to remove <div class="grid_8"></div>.
They will always be at the start and finish of my string, for example:
<div class="grid_8"><img src="http://rps.sanscode.com/site/assets/media/images/rps_mini_logo.png" border="0" alt="Rapid Print Solutions" style="margin-bottom: 30px;" />
<h1></h1>
</div>
什么是消除这一疾病的适当条例? 8人可在1至16岁之间。
增 编
son
@Amjad
我的法典
public function fix_grid(){
$result = db::query("select * from sc_content_components where component_value_1 like %grid_% ")->fetchAll(PDO::FETCH_ASSOC);
foreach($result as $item){
$json = json_decode($item[ component_value_1 ]);
if(is_null($json)) continue;
$x = reset($json);
echo htmlspecialchars($x);
echo "<p>=======================<b>Changes to: </b></p>";
$patterns = array( /^<(div)((?:s+w+(?:s*=s*(?:(?:"[^"]*")|(?: [^ ]* )|[^>s]+))?)*)s*(/?)>/
, /</(div+)[^>]*>$/ );
$x = preg_replace($patterns, array( , ), trim($x));
echo htmlspecialchars($x);
echo "<hr>";
$json[0]=$x;
// $ne[ component_value_1 ] = json_encode($json);
// db::where( component_id , $item[ component_id ]);
// db::update( sc_content_component , $ne);
}
}
I m 采用以下分类法(@Amjad Masad),它不去掉最后一部分。
你可以看到,我正在使用三米,看来没有工作。