“不推荐使用函数 split()"在 PHP 中? [英] "Function split() is deprecated" in PHP?

查看:32
本文介绍了“不推荐使用函数 split()"在 PHP 中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$stringText = "[TEST-1] 测试任务 1 创建:06/Apr/11 更新:06/Apr/11";$splitArray = split(" ",$stringText);

<块引用>

已弃用:函数 split() 在 C:\wamp\www\RSS.php 中第 27 行已弃用

为什么会发生这个错误?

解决方案

http://php.net/manual/en/function.split.php

来自手册

<块引用>

警告 此功能已被自 PHP 5.3.0 起弃用.依靠强烈建议不要使用此功能

注意:

从 PHP 5.3.0 开始,正则表达式扩展不赞成使用 PCRE延期.调用这个函数会发出 E_DEPRECATED 通知.见帮助的差异列表转换为 PCRE.

我猜你应该使用替代的 preg_split().或者,如果您不使用正则表达式,只需使用 explode

$stringText = "[TEST-1] test task 1 Created: 06/Apr/11  Updated: 06/Apr/11"; 
$splitArray = split(" ",$stringText);

Deprecated: Function split() is deprecated in C:\wamp\www\RSS.php on line 27

Why this error happen ?

解决方案

http://php.net/manual/en/function.split.php

From the manual

Warning This function has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly discouraged

Note:

As of PHP 5.3.0, the regex extension is deprecated in favor of the PCRE extension. Calling this function will issue an E_DEPRECATED notice. See the list of differences for help on converting to PCRE.

I guess you're supposed to use the alternative preg_split(). Or if you're not using a regex, just use explode

这篇关于“不推荐使用函数 split()"在 PHP 中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆