如何将字符串数据发送到 JavaScript 中?
我正在使用 v8,我遇到了下一个问题 - 我有一个运行 javascript 文件的应用程序(我只是将其读入字符串,然后执行
Local<String> source = String::New(javascript); //javascript is string with js file
Local<Script> script = Script::Compile(source);
Local<Value> result = script->Run();
如何将字符串变量发送到该文件中?
I am using v8 and i faced next problem - i have an application which running a javascript file ( i simply read it into a string and than execute with
Local<String> source = String::New(javascript); //javascript is string with js file
Local<Script> script = Script::Compile(source);
Local<Value> result = script->Run();
how can I send a string variable into this file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在脚本源中放置一个占位符,例如
STRING_HERE
。然后,在创建源对象之前,在字符串中找到该占位符并将其替换为所需的字符串值。Put a placeholder in the script source, like
STRING_HERE
. Then, before creating the source object, find that placeholder in the string and replace it with the string value you want.