Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/282.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用php从html字符串中删除特定类_Php_Html - Fatal编程技术网

使用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。