php中“Deprecated: Function split() is deprecated in”异常解决方法

WBOY
Release: 2016-06-13 11:54:24
Original
928 people have browsed it

php中“Deprecated: Function split() is deprecated in”错误解决办法

出现这个错误的原因是:函数split()在 PHP5.3 中已经不建议使用了。

解决办法:用preg_split()函数替代split()。

举例说明:有一个字符串 $str="123@@describe"  ,要将其拆分为$id=123,$des="describe";

对于php5.3以后的版本,本人用的是php5.6,,测试代码如下

<?php // 分隔符可以是@@$date = "123@@describe";list($id, $des) = preg_split ('/@@/', $date);echo "id: $id; des: $des;<br />\n";?> 
Copy after login
输出结果如下图

    

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!