略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: 范例

2024-04-26

范例

Basic usage

示例 #1 Basic Javascript execution

<?php

$v8 
= new V8Js();

/* basic.js */
$JS = <<< EOT
len = print('Hello' + ' ' + 'World!' + "\\n");
len;
EOT;

try {
  
var_dump($v8->executeString($JS'basic.js'));
} catch (
V8JsException $e) {
  
var_dump($e);
}

?>

以上例程会输出:

Hello World!
int(13)
add a noteadd a note

User Contributed Notes

There are no user contributed notes for this page.

官方地址:https://www.php.net/manual/en/v8js.examples.php

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