Php HTTP请求失败!未找到HTTP/1.1 404
我已经将我的站点从本地导入到了一个实时服务器,这个错误只出现在我的4张图片上,并且在本地服务器上工作得非常好 警告: getimagesize() [function.getimagesize]:无法打开流:HTTP请求失败! 在中找不到HTTP/1.1 404 /nfs/c11/h03/mnt/206312/domains/theshavingsaloon.com/html/wp-content/plugins/wr-pagebuilder/shortcodes/image/image.php 在线223 下面是关于第223行的if语句,如果有帮助的话Php HTTP请求失败!未找到HTTP/1.1 404,php,wordpress,Php,Wordpress,我已经将我的站点从本地导入到了一个实时服务器,这个错误只出现在我的4张图片上,并且在本地服务器上工作得非常好 警告: getimagesize() [function.getimagesize]:无法打开流:HTTP请求失败! 在中找不到HTTP/1.1 404 /nfs/c11/h03/mnt/206312/domains/theshavingsaloon.com/html/wp-content/plugins/wr-pagebuilder/shortcodes/image/image.php
if ($image_file) {
$image_id = WR_Pb_Helper_Functions::get_image_id($image_file);
$attachment = wp_prepare_attachment_for_js( $image_id );
$image_file = (!empty( $attachment['sizes'][$image_size]['url'])) ? $attachment['sizes'][$image_size]['url'] : $image_file;
$data = getimagesize( $image_file );
$width = $data[0];
$height = $data[1];
$html_elemments .= "<img width='{$width}' height='{$height}' src='{$image_file}'{$alt_text}{$class_img} />";
$script = '';
$target = '';
}
if($image\u文件){
$image\u id=WR\u Pb\u Helper\u函数::get\u image\u id($image\u文件);
$attachment=wp_为_js准备_attachment_($image_id);
$image\u file=(!empty($attachment['size'][$image\u size]['url'])?$attachment['size'][$image\u size]['url']:$image\u文件;
$data=getimagesize($image\u文件);
$width=$data[0];
$height=$data[1];
$html_元素=“”;
$script='';
$target='';
}
我猜您已经为“localhost”留下了硬编码的图像URL。
您应该使用plugin\u dir\u url()
方法自动生成url。
有关codex的功能信息,请参阅链接
另外,您还可以使用
wp\u get\u template\u directory\u uri()在主题模板文件中使用的相对于-/wp content/themes/'
的路径。通过getimagesize
函数传递了错误的图像URL。这似乎是采取当地的图像网址
您应该检查$image\u文件
是否包含正确的图像url
http://localhost/theshavingsaloonNEW
这是本地主机url,而不是生产url。尝试以下选项以解决以下问题:
http://localhost
。替换为get\u site\u url()./restofull
谢谢你依赖我的查询!我已将数据库中的localhost替换为我的域名,但在我的主题文件夹或子主题文件夹中找不到任何本地主机实例?这正常吗?因为错误仍在出现,而现在编辑的主题的更多方面已消失?警告:getimagesize()[function.getimagesize]:无法打开流:HTTP请求失败!HTTP/1.1 404在第223行的/nfs/c11/h03/mnt/206312/domains/theshavingsaloon.com/html/wp-content/plugins/wr-pagebuilder/shortcodes/image/image.php中找不到-这是一个错误,现在主题中应该没有本地主机引用。您应该使用get_site_url()获取正确的主url。从您发布的url中可以看到,wp现在认为您的url是,您是否在任何url前面预先设置了havingsalonnew?搜索你的主题,以及这个。还要检查已定义的任何常量。