使用php从html字符串中删除特定类
我有一根像使用php从html字符串中删除特定类,php,html,Php,Html,我有一根像 $string = '<img class="img-responsive animate scale animated" src="image/catalog/blocks/about-banner.jpg" alt="">'; $string=''; 我想从中删除img responsive类。怎么做?试试这个:$string=str\u replace('img-responsive',''$string)试试这个:$string=str\u replace('
$string = '<img class="img-responsive animate scale animated" src="image/catalog/blocks/about-banner.jpg" alt="">';
$string='';
我想从中删除
img responsive
类。怎么做?试试这个:$string=str\u replace('img-responsive',''$string)代码>试试这个:$string=str\u replace('img-responsive',''$string)
在Php中,您可以使用str\u replace
函数,如下所示:
$string = '<img class="img-responsive animate scale animated" src="image/catalog/blocks/about-banner.jpg" alt="">';
$new_string = str_replace('img-responsive', '' , $string);
在Php中,您可以使用str\u replace
函数,如下所示:
$string = '<img class="img-responsive animate scale animated" src="image/catalog/blocks/about-banner.jpg" alt="">';
$new_string = str_replace('img-responsive', '' , $string);
嘿,你可以在脚本中添加以下代码:
<script>
$(document).ready(function(){
$('.animate').removeClass('img-responsive');
});
</script>
$(文档).ready(函数(){
$('.animate').removeClass('img-responsive');
});
嘿,你可以在脚本中添加以下代码:
<script>
$(document).ready(function(){
$('.animate').removeClass('img-responsive');
});
</script>
$(文档).ready(函数(){
$('.animate').removeClass('img-responsive');
});
您可以在php上找到有关替换的所有函数:
您可以在php上找到有关替换的所有函数:
使用退格。使用php搜索并替换内置函数使用退格。使用php搜索并替换php和html中询问的内置函数,您已经回答了不需要的jquery。php和html中询问的问题,您已经回答了不需要的jquery。