Is it possible to detect usb devices using php?

吃可爱长大的小学妹 提交于 2019-12-25 06:36:44

问题


Is it possible to detect usb mouse,keyboard or flash drives when they are connected using php?


回答1:


Which side - server side or client side?

Server side: possible, although probably not a good idea. You would call OS specific functions or shell commands to access USB (e.g. shell_exec("lsusb -v"); ), and process the results.

Client side: No. PHP just works on server side.

Commandline PHP: same as Server side.

You are using the wrong tool for the job. Go back and use one more suited to the task.




回答2:


This is not really a matter of PHP, but of the underlying operating system. If the operating system detects it and makes the information readable for the user that runs the PHP script, you can "detect" devices using PHP.



来源:https://stackoverflow.com/questions/4758772/is-it-possible-to-detect-usb-devices-using-php

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!