Codeigniter - 附加来自 CDN 的文件
我正在尝试使用 CodeIgniter 从我的 CDN 中拉取,从我的网站附加一个文件。我假设它没有附加,因为跨域安全问题。如何使用 CodeIgniter 从我可以控制的另一台服务器附加文件?
$this->load->helper('email');
$this->email->from('[email protected]');
$this->email->to($this->input->post('email'));
$retval = $this->crud_model->read('posts', $post_id);
$post = $retval[0];
$this->email->subject($post->title);
$this->email->message('Location: '.$this->config->item('cdn_media_url').$post->image_path);
$this->email->attach($this->config->item('cdn_media_url').$post->image_path);
谢谢。
I am trying to attach a file from from my website using pulling from my CDN using CodeIgniter. It does not attach I am assuming because cross domain security issue. How can I attach a file using CodeIgniter from another server that I have control over?
$this->load->helper('email');
$this->email->from('[email protected]');
$this->email->to($this->input->post('email'));
$retval = $this->crud_model->read('posts', $post_id);
$post = $retval[0];
$this->email->subject($post->title);
$this->email->message('Location: '.$this->config->item('cdn_media_url').$post->image_path);
$this->email->attach($this->config->item('cdn_media_url').$post->image_path);
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您无法将 HTTP 位置标头和 URL 附加到电子邮件。这根本没有道理。
使用
file_get_contents
或cURL
从 CDN 下载图像,然后您可以在代码中提供其在服务器上的本地路径。You can't attach HTTP Location headers and URLs to e-mail. That just doesn't make sense.
Download the image from your CDN with
file_get_contents
orcURL
, then you can provide its local path on your server in the code.