Home > Backend Development > PHP Tutorial > php字符串操作

php字符串操作

WBOY
Release: 2016-06-23 14:27:25
Original
796 people have browsed it

字符串:{user:link islocal='1'} /2013/userup/100/131a2Z34-800.doc {/user:link}
如何提取出/2013/userup/100/131a2Z34-800.doc


回复讨论(解决方案)

$str = "{user:link islocal='1'} /2013/userup/100/131a2Z34-800.doc {/user:link}";$preg = "#\{.*\}(.*)\{.*\}#iuUs";preg_match_all($preg, $str, $matches);print_r($matches[1]);
Copy after login

正则 #}\s*(\S+)\s*{#
或者用split()依据空格或花括号切分也能得到

Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template