php - 如何将多个标签更改为?
问题描述
<?php
$content_description = '<p><strong><em>They have added their own unique spin to marketing technology and convinced us that their refreshing understanding of the whys and wherefores of this rapidly growing industry is just one of the several ways to look at business. In this feature, we bring you the views of key executives who discuss how their ‘being’ pours into their professional personas </em></strong></p>
<p style="text-align: center;"><span style="color:#FF8C00;font-size:21px;"><strong>How does being a woman as a part of an exponentially explosive marketing tech space help you to be better equipped to understand this constantly evolving sector through your unique perspective?</strong></span></p>
<p><span style="color:#000080;"><strong>Nikki Nixon, Director #FlipMyFunnel at Terminus</strong></span></p>
<p><img alt="" class="lazy" src="https://images.martechadvisor.com/images/uploads/ckimages/images/nikki_nixon_terminus_58c049be4adc8.jpg" style="float: left; width: 125px; height: 107px; margin: 3px;" />“Being a woman in marketing tech, coupled with being an introvert, has given me tremendous advantages. I’ve had the opportunity to grow two software companies in the space and be uniquely empathetic along the way. My introversion allows me to think critically about the pros and cons of a given tool beyond the surface sales pitch. It allows me to dig deeper and ask questions to determine if the tool will really solve my needs.”</p>
<p><span style="color:#000080;"><strong>Jen Spencer, Vice President of Sales and Marketing at Allbound</strong></span></p>
<p><img alt="" class="lazy" src="https://images.martechadvisor.com/images/uploads/ckimages/images/jen_square_58c049dae10c2.jpg" style="float: right; width: 125px; height: 103px; margin: 3px;" />“Since I’m a woman, and I’ve always been a woman, I don’t know any other way of being. I can’t begin to assume I know what makes me as a woman better suited to lead a sales and marketing team at a SaaS company than a man – except maybe that having had twins, I know I have more stamina than most. Getting by on 4 hours of sleep a night? No problem! Getting those 4 hours of sleep in 1 hour increments over a 12-hour period? I. Will. Win.<br />
?>
我需要将所有 Img 标签替换<amp-img>
为所有图像的格式应该看起来像。<amp-img src="/img/amp.jpg" width="1080" height="610" layout="responsive" alt="AMP"></amp-img>
解决方案
您可以使用以下方法实现您的目标
- 删除内容的内联 css,因为 amp 不支持内联 css
- 将
<img>
标签转换为<amp-img>
标签,同时添加高度、宽度和布局(amp 要求)
这是工作网址:单击此处
代码 :
<?php
$content_description = '<p><strong><em>They have added their own unique spin to marketing technology and convinced us that their refreshing understanding of the whys and wherefores of this rapidly growing industry is just one of the several ways to look at business. In this feature, we bring you the views of key executives who discuss how their ‘being’ pours into their professional personas </em></strong></p>
<p style="text-align: center;"><span style="color:#FF8C00;font-size:21px;"><strong>How does being a woman as a part of an exponentially explosive marketing tech space help you to be better equipped to understand this constantly evolving sector through your unique perspective?</strong></span></p>
<p><span style="color:#000080;"><strong>Nikki Nixon, Director #FlipMyFunnel at Terminus</strong></span></p>
<p><img alt="" class="lazy" src="https://images.martechadvisor.com/images/uploads/ckimages/images/nikki_nixon_terminus_58c049be4adc8.jpg" style="float: left; width: 125px; height: 107px; margin: 3px;" />“Being a woman in marketing tech, coupled with being an introvert, has given me tremendous advantages. I’ve had the opportunity to grow two software companies in the space and be uniquely empathetic along the way. My introversion allows me to think critically about the pros and cons of a given tool beyond the surface sales pitch. It allows me to dig deeper and ask questions to determine if the tool will really solve my needs.”</p>
<p><span style="color:#000080;"><strong>Jen Spencer, Vice President of Sales and Marketing at Allbound</strong></span></p>
<p><img alt="" class="lazy" src="https://images.martechadvisor.com/images/uploads/ckimages/images/jen_square_58c049dae10c2.jpg" style="float: right; width: 125px; height: 103px; margin: 3px;" />“Since I’m a woman, and I’ve always been a woman, I don’t know any other way of being. I can’t begin to assume I know what makes me as a woman better suited to lead a sales and marketing team at a SaaS company than a man – except maybe that having had twins, I know I have more stamina than most. Getting by on 4 hours of sleep a night? No problem! Getting those 4 hours of sleep in 1 hour increments over a 12-hour period? I. Will. Win.<br />';
$content = preg_replace('/style=[^>]*/', '', $content_description);
$html = preg_replace('/<img(.*?)\/?>/', '<amp-img$1 width="1080" height="610" layout="responsive" alt="AMP"></amp-img>',$content);
echo $html;
?>
推荐阅读
- php - 当我 save() 时,“App\Post”返回 500 错误
- javascript - 在为父组件生成样式之后放置material-ui为子组件生成的样式?
- python - subprocess.Popen.communicate 无异常地返回一个元组
- junit5 - 协议提供者测试中断:pactVerificationTestTemplate » PreconditionViolation
- spring - Spring LDAP ADLDS 用户更改密码/密码策略问题的权限
- c - 将二维数组传递给采用指针的函数
- mysql - 将 JOIN 查询重写为子查询,缺少行?
- maude-system - 为什么这个自然数的定义在 Maude 中是正确的?
- sql - 选择引用表 SQL 中的条件的函数
- r - 如何使用列的第一个值作为ggplot中的副标题?