Is there anything like Python's ctype for PHP? Accessing libraries without the need to write an extension?

前端 未结 5 1981
野趣味
野趣味 2020-12-18 00:02

Python has ctypes to access libraries. In PHP you write extensions for everything. Popular extensions like the one for libgd are available almost everywhere.

Is ther

相关标签:
5条回答
  • 2020-12-18 00:19

    There is a PHP extension (irony?) called ffi. FFI stands for Foreign Function Interface, which is the generic term for when a language calls libraries written in another language.

    0 讨论(0)
  • 2020-12-18 00:32

    You're looking for ffi.

    0 讨论(0)
  • 2020-12-18 00:35

    PHP 7.3 will have FFI (Foreign Function Interface).

    0 讨论(0)
  • 2020-12-18 00:41

    I don't think there is such a thing : in PHP, the "standard" way of using a library is by writting a wrapper arround it, that exports the functions of the library to PHP.

    (But maybe an extension could be written to do just what ctypes does ? -- Not sure, but maybe ^^ )

    0 讨论(0)
  • 2020-12-18 00:42

    I don't know of any way. But you could let SWIG build an extension for the library you want.

    0 讨论(0)
提交回复
热议问题