略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: LuaSandbox

2024-12-22

The LuaSandbox class

(PECL luasandbox >= 1.0.0)

简介

The LuaSandbox class creates a Lua environment and allows for execution of Lua code.

类摘要

class LuaSandbox {
/* Constants */
const int SAMPLES = 0;
const int SECONDS = 1;
const int PERCENT = 2;
/* 方法 */
public callFunction(string $name, mixed ...$args): array|bool
public disableProfiler(): void
public enableProfiler(float $period = 0.02): bool
public getCPUUsage(): float
public getMemoryUsage(): int
public getPeakMemoryUsage(): int
public getProfilerFunctionReport(int $units = LuaSandbox::SECONDS): array
public static getVersionInfo(): array
public loadBinary(string $code, string $chunkName = ''): LuaSandboxFunction
public loadString(string $code, string $chunkName = ''): LuaSandboxFunction
public pauseUsageTimer(): bool
public registerLibrary(string $libname, array $functions): void
public setCPULimit(float|bool $limit): void
public setMemoryLimit(int $limit): void
public unpauseUsageTimer(): void
}

预定义常量

LuaSandbox::SAMPLES

Used with LuaSandbox::getProfilerFunctionReport() to return timings in samples.

LuaSandbox::SECONDS

Used with LuaSandbox::getProfilerFunctionReport() to return timings in seconds.

LuaSandbox::PERCENT

Used with LuaSandbox::getProfilerFunctionReport() to return timings in percentages of the total.

目录

add a noteadd a note

User Contributed Notes

There are no user contributed notes for this page.

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

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