gpt4 book ai didi

php - 从 URL 获取 HTML 字符串

转载 作者:搜寻专家 更新时间:2023-10-31 21:00:34 26 4
gpt4 key购买 nike

这是我发送电子邮件的代码:

$result = $client->sendEmail([
'Message' => [
'Body' => [
'Html' => [
'Data' => '<string>', // PUT HTML FILE HERE
],
'Text' => [
'Data' => '<string>',
],
]
]
]);

我有一个 template.php 文件,它是电子邮件模板。我不想将它粘贴到 html 数据中,因为它太长而且看起来杂乱无章。如何使用链接或在 Html Data 字段中获取 http://www.example.com/template.php 的内容或网址?

最佳答案

可以得到http://www.example.com/template.php的内容通过 file_get_contents

$result = $client->sendEmail([
'Message' => [
'Body' => [
'Html' => [
'Data' => file_get_contents('http://www.example.com/template.php'),
],
'Text' => [
'Data' => '<string>',
],
]
]
]);

关于php - 从 URL 获取 HTML 字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43942421/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com