ExternalBundle[{"name1"obj1,"name2"obj2,…}]
表示资源的捆绑,在外部部署为已命名 URL、函数等.
ExternalBundle[{name11{name1…,…},…}]
表示资源的嵌套捆绑.
ExternalBundle
ExternalBundle[{"name1"obj1,"name2"obj2,…}]
表示资源的捆绑,在外部部署为已命名 URL、函数等.
ExternalBundle[{name11{name1…,…},…}]
表示资源的嵌套捆绑.
更多信息
- 在 CloudDeploy 或者目标网页的 EmbedCode 中,ExternalBundle 定义了目录的内容或者目录在云端中级别.
- 在语言的 EmbedCode 中,ExternalBundle 定义了已命名外部函数的捆绑函数.
范例
打开所有单元 关闭所有单元基本范例 (1)
bundle = CloudDeploy[ExternalBundle[{"factor" -> APIFunction["n" -> "Integer", FactorInteger[#n]&], "primeq" -> APIFunction["n" -> "Integer", PrimeQ[#n]&]}]]contents = Get[bundle]URLExecute[Lookup[First[contents], "factor"], {"n" -> 187}]范围 (2)
bundle = CloudDeploy[
ExternalBundle[
{
"api" -> {"factor" -> APIFunction["n" -> "Integer", FactorInteger[#n]&], "primeq" -> APIFunction["n" -> "Integer", PrimeQ[#n]&]},
"form" -> {"factor" -> FormPage["n" -> "Integer", FactorInteger[#n]&], "primeq" -> FormPage["n" -> "Integer", PrimeQ[#n]&]}
}]]Get[bundle]bundle = CloudDeploy[ExternalBundle[{"square" -> APIFunction[{"s" -> "Integer"}, #x^2&], "root" -> APIFunction[{"r" -> "Integer"}, Sqrt[#x]&]}]]
EmbedCode[bundle]属性和关系 (2)
通过部署和管理目录内的单个对象,也能实现类似的效果. 创建一个项目目录:
dir = CreateDirectory[CloudObject["api-bundle"]]CloudDeploy[APIFunction["n" -> "Integer", FactorInteger[#n]&], CloudObject["factor", dir]]
CloudDeploy[APIFunction["n" -> "Integer", PrimeQ[#n]&], CloudObject["primeq", dir]]CloudObjects[dir]这种方法的主要区别在于,ExternalBundle 内的对象是在一个步骤中部署的.
用 URLDispatcher 也可以实现类似的效果:
dispatch = CloudDeploy[URLDispatcher[{
"/factor" :> APIFunction["n" -> "Integer", FactorInteger[#n]&],
"/primeq" :> APIFunction["n" -> "Integer", PrimeQ[#n]&]
}]]调度器是一个单一对象,它根据对象的 URL 后面出现的 URL 模式来响应请求. 调用调度器,在 URL 后加上 "/factor" 以激活用于因式分解的 APIFunction:
URLExecute[CloudObject["factor", dispatch], {"n" -> 187}]文本
Wolfram Research (2014),ExternalBundle,Wolfram 语言函数,https://reference.wolfram.com/language/ref/ExternalBundle.html.
CMS
Wolfram 语言. 2014. "ExternalBundle." Wolfram 语言与系统参考资料中心. Wolfram Research. https://reference.wolfram.com/language/ref/ExternalBundle.html.
APA
Wolfram 语言. (2014). ExternalBundle. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/ref/ExternalBundle.html 年
BibTeX
@misc{reference.wolfram_2026_externalbundle, author="Wolfram Research", title="{ExternalBundle}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/ExternalBundle.html}", note=[Accessed: 16-September-2026]}
BibLaTeX
@online{reference.wolfram_2026_externalbundle, organization={Wolfram Research}, title={ExternalBundle}, year={2014}, url={https://reference.wolfram.com/language/ref/ExternalBundle.html}, note=[Accessed: 16-September-2026]}