下载PHP时的nts/ts版是什么,有什么区别

PHP与SEO 思享 1046浏览

我们在下载PHP的时候,会碰到nts版和ts版,(有的时候ts会省略不写,默认为ts版)那么,这到底是是什么意思呢?有什么区别。

nts/ts是什么意思

网上搜索一下,我们就知道,ts其实是线程安全的意思,而nts则是指非线程安全

这两者的区别是:

ts版多线程访问时采用了加锁机制,当一个线程访问该类的某个数据时其他线程不能同时访问;

nts则不提供线程访问保护,多个线程可以同时操作同一数据。

这两种类型为PHP官方提供的两种类型

怎么知道现在使用的PHP是什么版本

当我们要替换版本时,或者某些功能是需要知道自己的PHP是什么版本的,那么我们怎么知道自己的PHP是nts还是ts呢?

其实方法也很简单,我们可以通过phpinfo();打印PHP信息,其中我们可以看到

PHP线程安全

Thread Safety如果是disables,则是nts,enabled则是ts版

推荐阅读

Function get_magic_quotes_gpc() is deprecated报错解决办法

在 PHP 7.4 及更高版本中, get_magic_quotes_gpc() 函数已被弃用。 This means that code using this function will raise a warning or error.以下是解决......

PHP提示:Warning: count():Parameter must be an array or an object that implements Countable

错误原因:PHP7.2以后,count()函数的参数无效时会抛出warning警告。...

PHP7.4 报错:Deprecated Functionality: implode(): Passing glue string after array is deprecated.

PHP7.4运行项目报错:Deprecated Functionality: implode(): Passing glue string after array is deprecated。只需交换 implode() 函数的两个参数!...