编程学问
  • 文章
  • 问题
  • 读书
  • 关于
  • 登录
  • « 资源类型
  • V8Js »
  • PHP Manual
  • V8js
  • 范例

范例

Basic usage

Example #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)
相关文章
php v8js the v8js classphp v8js the v8jsexception classphp math 函数 返回 exp number 1,甚至当 number 的值接近零也能计算出准确结果php fann 函数 清除缩放参数php fann 函数 返回 fann 训练数据精确的副本。php fann 函数 返回最小输出周期php gearmanworker wait for and perform jobsphp 生成器 向生成器中抛入一个异常php globiterator construct a directory using globphp v8js 简介php 安装/配置 资源类型php rararchive whether opening broken archives is allowedphp rarexception check whether error handling with exceptions is in usephp v8js construct a new v8js objectphp v8js 范例php v8js execute a string as javascript codephp v8js return an array of registered extensionsphp v8js return pending uncaught javascript exceptionphp v8js register javascript extensions for v8jsphp v8js 安装/配置
关注编程学问公众号
编程学问网 湘ICP备20001732号