略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: LuaSandbox::wrapPhpFunction

2024-11-14

LuaSandbox::wrapPhpFunction

(PECL luasandbox >= 1.2.0)

LuaSandbox::wrapPhpFunctionWrap a PHP callable in a LuaSandboxFunction

说明

public LuaSandbox::wrapPhpFunction(callable $function): LuaSandboxFunction

Wraps a PHP callable in a LuaSandboxFunction, so it can be passed into Lua as an anonymous function.

The function must return either an array of values (which may be empty), or null which is equivalent to returning the empty array.

Exceptions will be raised as errors in Lua, however only LuaSandboxRuntimeError exceptions may be caught inside Lua with pcall() or xpcall().

For more information about calling Lua functions and the return values, see LuaSandboxFunction::call().

参数

function

Callable to wrap.

返回值

Returns a LuaSandboxFunction.

参见

add a noteadd a note

User Contributed Notes

There are no user contributed notes for this page.

官方地址:https://www.php.net/manual/en/luasandbox.wrapphpfunction.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3