Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/262.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/11.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修改amazonapi图像URL_Php_Wordpress - Fatal编程技术网

用PHP修改amazonapi图像URL

用PHP修改amazonapi图像URL,php,wordpress,Php,Wordpress,我正在使用亚马逊的广告API获取大图像URL。我想修改要替换的URL .jpg 与 显示模板所需的正确大小。我正在使用Wordpress和一个名为AmazonSimpleAdmin的插件 我相信这是插件代码的一部分,我需要做一些事情: $replace = array( // ... ($item->LargeImage != null) ? $item->LargeImage->Url->getUri() : get_bloginfo('wpurl'

我正在使用亚马逊的广告API获取大图像URL。我想修改要替换的URL

.jpg

显示模板所需的正确大小。我正在使用Wordpress和一个名为AmazonSimpleAdmin的插件

我相信这是插件代码的一部分,我需要做一些事情:

$replace = array(
  // ...   
  ($item->LargeImage != null) ? $item->LargeImage->Url->getUri() :
  get_bloginfo('wpurl') . $this->plugin_dir . '/img/no_image.gif',
我不太懂PHP,但据我所知,大型图像URL是数组的一部分,我知道我需要更改的部分是

$item->LargeImage->Url->getUri()

但这是我所能想到的。非常感谢您的帮助。

不知道该怎么办。我不能直接把它插入数组,对吗?返回的URL是完整的URL,那么完整的URL是否为$string?是的,
$string=http://site.com/image.jpg';
并且它将用.SS300..jpg替换.jpg。非常感谢!我把它放在数组的末尾,使它工作起来:
$replace=str_replace(“.jpg”、“.SS300_u.jpg”、$replace)$replace=str_replace(“.\u SL160.\u SS300.\uu.jpg”,“.\u SS160.\uu.jpg”,$replace)这确实为我修复了它,但它是一个混乱的修复,不是吗。有更好的方法吗?我需要看完整的代码,我不能帮你处理这段代码。
$string = '.jpg';
$string = str_replace('.jpg', '._SS300_.jpg', $string);
// Do something with $string.
$string = '.jpg';
$string = str_replace('.jpg', '._SS300_.jpg', $string);
// Do something with $string.