Home Backend Development PHP Tutorial 替换结构再判断解决办法

替换结构再判断解决办法

Jun 13, 2016 am 10:25 AM
height lt quot width

替换结构再判断



改为:

Image:ESIL_xiaoshengqi1.gif

width和height的值是变动的,如果width 如果width > 805 
那么height = height * 805 /width ; 
  width= 805

这个正则加判断怎么写啊?最近用到好多正则,怎么样才能把正则学好呢?


------解决方案--------------------
请说明你的规则

../Documents/medies/ESIL_xiaoshengqi1.gif
这个乍来的


Image:ESIL_xiaoshengqi1.gif 这个呢?



width="550" height=" 400" 这个呢???上面有两个,需要哪个?



------解决方案--------------------
参考一下:

PHP code
$s=<param name="movie" value="/images/1/17/ESIL_xiaoshengqi2.swf"><param name="bgcolor" value="#FFFFFF"><param name="scale" value="exactfit"><embed src="/images/1/17/ESIL_xiaoshengqi2.swf" width="1000" height="400" bgcolor="#FFFFFF" scale="exactfit" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed> html;$r= preg_replace('#.+<embed>]*>.+#s','<img src="/static/imghw/default1.png" data-src="../Documents/medies/$2" class="lazy" alt="Image:$2"    style="max-width:90%" height="$4" longdesc="/index.php/Image:$2">',$s);preg_match('#width="(\d+)"\s*height="(\d+)"#i',$r,$m);if($m[1]>805){          $h=($m[2]*805)/$m[1] ;          $r=preg_replace('/(width=)"(\d+)"(\s*height=)"(\d+)"/s','$1"$2"$3"'.$h.'"',$r);}echo $r;<br><font color="#e78608">------解决方案--------------------</font><br><dl class="code">PHP code<pre class="brush:php;toolbar:false">$s =<param name="movie" value="/images/1/17/ESIL_xiaoshengqi2.swf"><param name="bgcolor" value="#FFFFFF"><param name="scale" value="exactfit"><embed src="/images/1/17/ESIL_xiaoshengqi2.swf" width="1550"  style="max-width:90%" bgcolor="#FFFFFF" scale="exactfit" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed> TXT;$r= preg_replace_callback('#.+<embed>]*>.+#s', 'back', $s);function back($r) {  if($r[3] > 805) {    $r[4] = round($r[4]*805/$r[3]);    $r[3] = 805;  }  return TXT;}echo $r;<div class="clear">
                 
              
              
        
            </div></embed>
Copy after login
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What does the width of html mean? What does the width of html mean? Jun 03, 2021 pm 02:15 PM

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提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决 Jun 13, 2016 am 10:23 AM

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

Detailed explanation of CSS dimension properties: height and width Detailed explanation of CSS dimension properties: height and width Oct 21, 2023 pm 12:42 PM

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

请教怎么修改url某一参数的参数值呢?是要拆开了再拼回去吗 请教怎么修改url某一参数的参数值呢?是要拆开了再拼回去吗 Jun 13, 2016 am 10:24 AM

请问如何修改url某一参数的参数值呢?是要拆开了再拼回去吗?那么请问如何修改url某一参数的参数值呢?是要拆开了再拼回去吗?http://127.0.0.1/myo/newuser.php?mod=search&type=fastone比如现在我要修改mod=new要怎么做呢?------解决方案--------------------发送了请求

Microsoft is rolling out Windows 11 23H2 build to the release preview channel with Copilot Microsoft is rolling out Windows 11 23H2 build to the release preview channel with Copilot Sep 28, 2023 pm 07:17 PM

Everyone is looking forward to today's Windows 1123H2 release. In fact, Microsoft has just launched updates to the release preview, which is the closest channel before the official release stage. Known as Build 22631, Microsoft said they are rolling out the new rebranded chat app, phone link, and play together widgets that have been tested on other internal channels over the past few months. "This new update will have the same servicing branch and codebase as Windows 11 version 22H2 and will be cumulative with all newly announced features, including Copilot in Windows (preview)," Microsoft promises. Redmond officials further

What are the methods for expressing width value in css? What are the methods for expressing width value in css? Nov 13, 2023 pm 05:47 PM

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.

What does width mean in iframe What does width mean in iframe Sep 19, 2023 pm 12:00 PM

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 quickly removes the height attribute of an element jQuery quickly removes the height attribute of an element Feb 27, 2024 pm 02:09 PM

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

See all articles