« PHP 8.3 Manual トップ
著作権 »
per page, with , order by , clip by
Results of 1 - 10 of about 10 for sandbox (0.003 sec.)
LuaSandbox::pauseUsageTimer — Pause the CPU usage timer | PHP 8.3 13354
LuaSandbox::pauseUsageTimer (PECL luasandbox >= 1.4.0) LuaSandbox::pauseUsageTimer — Pause the CPU usage timer 説明 public function LuaSandbox::pauseUsageTimer (): bool Pauses the CPU usage timer. This only has effect when called from withi ... り値 Returns a bool indicating whether the timer is now paused. 例 例1 Manipulating the usage timer <?php // create a new LuaSandbox and set a CPU limit $sandbox = new LuaSandbox (); $sandbox -> setCPULimit ( 1 ); function doWait ( $t ) { $end = microtime ... ( true ) + $t ; while ( microtime ( true ) < $end ) { // waste CPU cycles } } // Register a PHP callback $sandbox -> registerLibrary ( 'php' , [ 'test' => function () use ( $sandbox ) { $sandbox -> pauseUsageTimer (); doWait ( 5 ); $san ... dbox -> unpauseUsageTimer (); doWait ( 0.1 ); }, 'test2' => function () use ( $sandbox ) { $sandbox -> pauseUsageTimer (); $sandbox -> unpauseUsageTimer (); doWait ( 1.1 ); } ] ); echo "This should not time ou ...
https://man.mtool.work/php/8.3/luasandbox.pauseusagetimer.html
Basic usage for LuaSandbox | PHP 8.3 10994
Basic usage for LuaSandbox Once you've compiled PHP with LuaSandbox support, you can begin using LuaSandbox to safely run user-provided Lua code. 例1 Execute some Lua code <?php $sandbox = new LuaSandbox ; $sandbox -> setMemoryLimit ( 50 * ... 1024 * 1024 ); $sandbox -> setCPULimit ( 10 ); // Register some functions in the Lua environment function frobnosticate ( $v ) { return [ $v + 42 ... ]; } $sandbox -> registerLibrary ( 'php' , [ 'frobnosticate' => 'frobnosticate' , 'output' => function ( $string ) { echo " $string \n" ... ; }, 'error' => function () { throw new LuaSandboxRuntimeError ( "Something is wrong" ); } ] ); // Execute some Lua code, including callbacks into PHP and into Lua $luaCode ...
https://man.mtool.work/php/8.3/luasandbox.examples-basic.html
LuaSandbox::setMemoryLimit — Set the memory limit for the Lua environment | PHP... 8903
LuaSandbox::setMemoryLimit (PECL luasandbox >= 1.0.0) LuaSandbox::setMemoryLimit — Set the memory limit for the Lua environment 説明 public function LuaSandbox::setMemoryLimit ( int $limit ): void Sets the memory limit for the Lua environme ... nt. If this limit is exceeded, a LuaSandboxMemoryError exception is thrown. パラメータ limit Memory limit in bytes. 戻り値 値を返しません。 例 例1 Calling a Lua funct ... ion <?php // create a new LuaSandbox $sandbox = new LuaSandbox (); // set a memory limit $sandbox -> setMemoryLimit ( 50 * 1024 * 1024 ); // Run Lua code $sand ... hile true do x = x .. x; end' )-> call (); ?> 上の例の出力は、 たとえば以下のようになります。 PHP Fatal error: Uncaught LuaSandboxMemoryError: not enough memory 参考 LuaSandbox::getMemoryUsage() - Fetch the current memory usage of the Lua environment Lu ...
https://man.mtool.work/php/8.3/luasandbox.setmemorylimit.html
LuaSandbox::getProfilerFunctionReport — Fetch profiler data | PHP 8.3 8777
LuaSandbox::getProfilerFunctionReport (PECL luasandbox >= 1.1.0) LuaSandbox::getProfilerFunctionReport — Fetch profiler data 説明 public function LuaSandbox::getProfilerFunctionReport ( int $units = LuaSandbox::SECONDS ): array For a profil ... ing instance previously started by LuaSandbox::enableProfiler() , get a report of the cost of each function. The measurement unit used for the cost is determined by the ... $units parameter: LuaSandbox::SAMPLES Measure in number of samples. LuaSandbox::SECONDS Measure in seconds of CPU time. LuaSandbox::PERCENT Measure per ... X, this function will report the elapsed wall-clock time, not CPU time. 例 例1 Profiling Lua code <?php // create a new LuaSandbox $sandbox = new LuaSandbox (); // Start the profiler $sandbox -> enableProfiler ( 0.01 ); // ... Execute some Lua code here ...
https://man.mtool.work/php/8.3/luasandbox.getprofilerfunctionreport.html
LuaSandbox::setCPULimit — Set the CPU time limit for the Lua environment | PHP ... 8581
LuaSandbox::setCPULimit (PECL luasandbox >= 1.0.0) LuaSandbox::setCPULimit — Set the CPU time limit for the Lua environment 説明 public function LuaSandbox::setCPULimit ( float | bool $limit ): void Sets the CPU time limit for the Lua envir ... onment. If the total user and system time used by the environment after the call to this method exceeds this limit, a LuaSandboxTimeoutError exception is thrown. Time used in PHP callbacks is included in the limit. Setting the time limit from a callba ... a float in seconds, or false for no limit. 戻り値 値を返しません。 例 例1 Calling a Lua function <?php // create a new LuaSandbox $sandbox = new LuaSandbox (); // set a time limit $sandbox -> setCPULimit ( 2 ); // Run Lua code $sandbox -> loadString ( ... 'while true do end' )-> call (); ?> 上の例の出力は、 たとえば以下のようになります。 PHP Fatal error: Uncaught LuaSandboxTimeoutError: The maximum execution time for this script was exceeded 参考 LuaSandbox::getCPUUsage() - Fetch the current CP ...
https://man.mtool.work/php/8.3/luasandbox.setcpulimit.html
LuaSandbox::callFunction — Call a function in a Lua global variable | PHP 8.3 8080
LuaSandbox::callFunction (PECL luasandbox >= 1.0.0) LuaSandbox::callFunction — Call a function in a Lua global variable 説明 public function LuaSandbox::callFunction ( string $name , mixed ...$args ): array | bool Calls a function in a Lua ... alse will be returned and a warning issued. For more information about calling Lua functions and the return values, see LuaSandboxFunction::call() . パラメータ name Lua variable name. args Arguments to the function. 戻り値 Returns an array of values ret ... Lua function, which may be empty, 失敗した場合に false を返します. 例 例1 Calling a Lua function <?php // create a new LuaSandbox $sandbox = new LuaSandbox (); // Call Lua's string.match $captures = $sandbox -> callFunction ( 'string.match' , $string , ...
https://man.mtool.work/php/8.3/luasandbox.callfunction.html
LuaSandbox::loadString — Load Lua code into the Lua environment | PHP 8.3 8080
LuaSandbox::loadString (PECL luasandbox >= 1.0.0) LuaSandbox::loadString — Load Lua code into the Lua environment 説明 public function LuaSandbox::loadString ( string $code , string $chunkName = '' ): LuaSandboxFunction Loads Lua code into ... ng() function. パラメータ code Lua code. chunkName Name for the loaded chunk, for use in error traces. 戻り値 Returns a LuaSandboxFunction which, when executed, will execute the passed $code . 例 例1 Loading code into Lua <?php // create a new LuaSandbo ... x $sandbox = new LuaSandbox (); // Load the code $function = $sandbox -> loadString ( <<<CODE return "Hello, world" CODE ); // Execut ... var_dump ( $function -> call () ); ?> 上の例の出力は以下となります。 array(1) { [0]=> string(12) "Hello, world" } 参考 LuaSandbox::registerLibrary() - Register a set of PHP functions as a Lua library LuaSandbox::wrapPhpFunction() - Wrap a PHP callable ...
https://man.mtool.work/php/8.3/luasandbox.loadstring.html
LuaSandbox::registerLibrary — Register a set of PHP functions as a Lua library ... 7883
LuaSandbox::registerLibrary (PECL luasandbox >= 1.0.0) LuaSandbox::registerLibrary — Register a set of PHP functions as a Lua library 説明 public function LuaSandbox::registerLibrary ( string $libname , array $functions ): void Registers a ... so that Lua can call the relevant PHP code. For more information about calling Lua functions and the return values, see LuaSandboxFunction::call() . パラメータ libname The name of the library. In the Lua state, the global variable of this name will be s ... sponding PHP callable . 戻り値 値を返しません。 例 例1 Registering PHP functions to call from Lua <?php // create a new LuaSandbox $sandbox = new LuaSandbox (); // Register some functions in the Lua environment function frobnosticate ( $v ) { return [ $ ... v + 42 ]; } $sandbox -> registerLibrary ( 'php' , [ 'frobnosticate' => 'frobnosticate' , 'output' => function ( $string ) { echo " $string \n" ...
https://man.mtool.work/php/8.3/luasandbox.registerlibrary.html
定義済み定数 | PHP 8.3 7633
定義済み定数 以下の定数が定義されています。 この関数の拡張モジュールが PHP 組み込みでコンパイルされているか、 実行時に動的にロードされている場合のみ使用可能です。 RUNKIT7_IMPORT_FUNCTIONS ( int ) runkit7_import() flag indicating that normal ... wise. RUNKIT7_FEATURE_SUPERGLOBALS ( int ) Equal to 1 if custom superglobals are enabled, and 0 otherwise. RUNKIT7_FEATURE_SANDBOX ( int ) Always 0, it's impractical to implement the sandbox feature in php 7. 他のマニュアルの関連ページ Linux JM make(1) ...
https://man.mtool.work/php/8.3/runkit7.constants.html
chown — ファイルの所有者を変更する | PHP 8.3 6990
chown (PHP 4, PHP 5, PHP 7, PHP 8) chown — ファイルの所有者を変更する 説明 function chown ( string $filename , string | int $user ): bool ファイル filename の所有者を(名前または番号で指定した) ユーザー user に変更しようと試みます。 スーパー ... ルな chown() の例 <?php // 使用するファイル名とユーザー名 $file_name = "foo.php" ; $path = "/home/sites/php.net/public_html/sandbox/" . $file_name ; $user_name = "root" ; // ユーザーを設定します chown ( $path , $user_name ); // 結果を確認します $stat = s ...
https://man.mtool.work/php/8.3/function.chown.html
PREV 1 NEXT