© 本文档使用 PHP中文网手册 发布
Basic usage
Example #1 Basic Javascript execution
<?php$v8 = new V8Js (); $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)