编程学问
  • 文章
  • 问题
  • 读书
  • 关于
  • 登录
  • « 资源类型
  • 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 finfo 别名 finfo file php ftp 安装/配置php apache 函数 获取 apache subprocess env 变量php statistic 函数 returns the power sum of a vectorphp 字符串 函数 基于区域设置的字符串比较php stream 函数 register a user defined stream filterphp v8js 简介php 快速入门与例子 mysql fabricphp mysqlnd mux change historyphp 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 安装/配置php yar server 创建一个http rpc serverphp 安装/配置 运行时配置
关注编程学问公众号
编程学问网 湘ICP备20001732号