本文整理匯總了PHP中UrlHelper::prepareUrl方法的典型用法代碼示例。如果您正苦於以下問題:PHP UrlHelper::prepareUrl方法的具體用法?PHP UrlHelper::prepareUrl怎麽用?PHP UrlHelper::prepareUrl使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UrlHelper
的用法示例。
在下文中一共展示了UrlHelper::prepareUrl方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: json_decode
$storage = new \GuzzleHttp\Subscriber\Cache\CacheStorage(new \Doctrine\Common\Cache\FilesystemCache(__DIR__ . '/cache'));
CacheSubscriber::attach($client, ['storage' => $storage]);
$data = json_decode($client->get('https://www.drupal.org/api-d7/node.json?type=project_release&taxonomy_vocabulary_7=100&field_release_build_type=static')->getBody());
$projects = [];
$conflict = [];
class UrlHelper
{
public static function prepareUrl($url)
{
return str_replace('https://www.drupal.org/api-d7/node', 'https://www.drupal.org/api-d7/node.json', $url);
}
}
while (isset($data) && isset($data->list)) {
$results = array_merge($results, $data->list);
if (isset($data->next)) {
$data = json_decode($client->get(UrlHelper::prepareUrl($data->next))->getBody());
} else {
$data = NULL;
}
}
foreach ($results as $result) {
$nid = $result->field_release_project->id;
$core = (int) substr($result->field_release_version, 0, 1);
// Skip D6 and older.
if ($core < 7) {
continue;
}
try {
if (!isset($projects[$nid])) {
$project = json_decode($client->get('https://www.drupal.org/api-d7/node.json?nid=' . $nid)->getBody());
$projects[$nid] = $project->list[0];