Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/232.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php HTTP请求失败!未找到HTTP/1.1 404_Php_Wordpress - Fatal编程技术网

Php HTTP请求失败!未找到HTTP/1.1 404

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

我已经将我的站点从本地导入到了一个实时服务器,这个错误只出现在我的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语句,如果有帮助的话

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。尝试以下选项以解决以下问题:

  • 在管理仪表板->设置->常规中更新wp地址URL,有两个需要更改

  • 执行数据库的sqldump并使用文本编辑器将localhost替换为您的域,然后重新上载

  • 如果您有自定义模板或自己制作主题,请下载当前主题文件夹/子主题,并使用文本编辑器查找
    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?搜索你的主题,以及这个。还要检查已定义的任何常量。