替换字符串的有关问题
替换字符串的问题
不用js,想将替换字符串width="80" height="80",如何写呢?
传入字符串
- HTML code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><img src="/static/imghw/default1.png" data-src="http://www.macaucentral.com/dev/images/stories/jreviews/649_Image00001_1304589016.jpg" class="lazy" style="max-width:90%" alt="替换字符串的有关问题" >
传出字符串
- HTML code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><img src="/static/imghw/default1.png" data-src="http://www.macaucentral.com/dev/images/stories/jreviews/649_Image00001_1304589016.jpg" class="lazy" style="max-width:90%" style="max-width:90%" alt="替换字符串的有关问题" >
------解决方案--------------------
echo str_replace('width="200"','width="80" height="80"',$str);
------解决方案--------------------
- PHP code
<?php $str='<img src="/static/imghw/default1.png" data-src="http://www.macaucentral.com/dev/images/stories/jreviews/649_Image00001_1304589016.jpg" class="lazy" style="max-width:90%" alt="替换字符串的有关问题" >';echo preg_replace('/width="\d+"/','width="80" style="max-width:90%",$str);<br><font color="#e78608">------解决方案--------------------</font><br>如果要在前台展示的时候动态替换的话那就非js莫属了。<br>要是后台那就php处理吧<div class="clear"> </div>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



In HTML5, width means width. The width attribute defines the width of the element's content area. You can add inner margins, borders, and outer margins outside the content area. You only need to set "element {width: value}" to the element.

php提交表单通过后,弹出的对话框怎样在当前页弹出php提交表单通过后,弹出的对话框怎样在当前页弹出而不是在空白页弹出?想实现这样的效果:而不是空白页弹出:------解决方案--------------------如果你的验证用PHP在后端,那么就用Ajax;仅供参考:HTML code

Detailed explanation of CSS dimension properties: height and width In front-end development, CSS is a powerful style definition language. Among them, height and width are the two most basic dimension attributes, used to define the height and width of the element. This article will analyze these two properties in detail and provide specific code examples. 1. Height attribute The height attribute is used to define the height of an element. You can use pixel, percentage or

Methods include pixel value, percentage, em unit, rem unit, vw/vh unit, auto, fit-content, min-content, max-content. Detailed introduction: 1. Pixel value (px): The pixel value is fixed, and its width remains unchanged no matter how the screen resolution changes. For example: width: 300px; 2. Percent (%): The percentage width is relative to the width of the parent element. For example: width: 50%; 3, em unit, etc.

Width in iframe means the width of the specified frame, which can control the width of the iframe displayed on the page. Acceptable values for width: 1. Fixed pixel value, width="300px", the frame width will always remain unchanged, no matter how the size of the browser window changes; 2. Percentage value, width="50%", the width of the frame It will be adaptively adjusted according to the width of its parent element; 3. Automatic value, width="auto", the width of the frame will be adaptively adjusted according to the width of its content.

jQuery is a JavaScript library widely used in web development. It provides developers with many convenient methods to manipulate and process web page elements. In actual development, we often need to operate the attributes of web page elements. One of the common requirements is to remove the height attribute of the element. In this article, we will introduce how to use jQuery to quickly remove the height attribute of an element and provide specific code examples. To remove the height attribute of an element, you can use jQu

不用数据库来实现用户的简单的下载,代码如下,但是却不能下载,请高手找下原因,文件路劲什么的没问题。

图片消失如何解决先是图片文件上传$file=$_FILES['userfile']; if(is_uploaded_file($file['tmp_name'])){$query=mysql_query("INSERT INTO gdb_banner(image_src ) VALUES ('images/{$file['name'
