Files
phpy/docs/en/python/function.md
tianfenghan d669a42060 Update docs
2023-12-14 12:48:30 +08:00

974 B

Function List

include Load File

The phpy module provides functions for loading and executing PHP code.

phpy.include("vendor/autoload.php")

globals Get Global Variables

print(phpy.globals("_ENV"))

Please note that the variable name should not include the $ symbol.

constant Get the Value of a Constant

print(phpy.constant("PHP_OS"))

eval Execute a Piece of PHP Code

phpy.eval("var_dump(get_loaded_extensions());")

call Call a PHP Function

It can be an extension function or a user-defined function. The first parameter is the name of the function, which must be a string. Other parameters will be passed as arguments to the called PHP function.

  • If a parameter is of reference type, you can use phpy.Reference() to wrap it.
  • Supports calling static methods of a class, for example: phpy.call("Test::main"))
print(phpy.call("file_get_contents", "/tmp/file.txt"))