【问题标题】:temporarily store remote images to server将远程图像临时存储到服务器
【发布时间】:2012-04-16 10:52:52
【问题描述】:
copy('https://graph.facebook.com/$fbid/picture?type=large', 'images/$fbid.jpg');

我正在使用上面的代码在本地存储图像..

上面的代码在没有变量的情况下工作。因为它不会在其中执行 php,所以它对包含 php 变量的链接毫无用处....

提供了与明确网址一起使用的代码... 我想分别使用上面的源和目标网址来获取图像... 请向我建议任何其他解决方法或方法,以允许执行带有变量的链接....

【问题讨论】:

    标签: php image facebook-graph-api store php-gd


    【解决方案1】:

    您的字符串被包裹在' ' 中,要使用变量插值,您需要将您的字符串包裹在" " 中,这样copy("https://graph.facebook.com/$fbid/picture?type=large", "images/$fbid.jpg"); 才能工作。

    此外,为了更清楚起见,可以将变量包装在 { } 中,因此 "Hello {$world}" 将假设 $world 包含“World”,打印“Hello World”。

    还有一些其他问题,请查看我在本文底部放置的字符串的 PHP 手册页。

    参考:http://php.net/manual/en/language.types.string.php

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-02
      • 2011-02-28
      相关资源
      最近更新 更多