Home >Backend Development >PHP Tutorial >PHP适合做游戏后端吗?

PHP适合做游戏后端吗?

PHPz
PHPzOriginal
2016-06-13 11:30:592743browse

PHP适合做游戏后端吗?

PHP适合做游戏后端吗?

PHP不适合做游戏后端,原因如下:

  • 原生PHP不支持多线程。原生的PHP语言对多线程几乎没有相应的支持方案,虽然可以安装第三方库Swoole来实现,但是系统资源占用高,不如直接使用C或者JAVA实现;

  • 不能常驻内存。PHP作为网页脚本,几乎不涉及常驻内存,虽然可以使用set_time_limit(0)和ignore_user_abort()来让脚本后台持续运行,但是其可靠性根本达不到;

  • 不能作为后台服务运行。php是基于服务器软件运行的,自身并不能独立运行;

  • PHP高并发支持较差。

所以,说白了,PHP就是比较懒,用户请求一次,它响应一次,不在后台主动运行。所以不适合作为游戏服务后台。

更多相关知识,请访问 PHP中文网!!

Statement:
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