Skip to content

Latest commit

 

History

History
35 lines (26 loc) · 974 Bytes

function.md

File metadata and controls

35 lines (26 loc) · 974 Bytes

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"))