PHP 课程今天完全忘记了一些东西 - 抱歉

发布于 2024-09-05 14:50:53 字数 1755 浏览 6 评论 0原文

真的很抱歉“今天太厚了”,但我忘记了如何做一些简单的事情 - 最近太多时间不在 php 中。

想要使用操作系统phpapi 我如何打印出各个行 - 请参阅告诉你我今天很厚

 // The fields we will be fetching.


 if (isset($_GET['test']) && $_GET['test'] == 'plaxo') {
    // plaxo is a PortableContacts end-point so doesn't know about the OpenSocial specific fields
    $profile_fields = array();
  } else {
    $profile_fields = array(
        'aboutMe',
        'displayName',
        'bodyType',
        'currentLocation',
        'drinker',
        'happiestWhen',
        'lookingFor'
    );
  }

// 要获取的朋友数量。

  $friend_count = 2;

$batch = $osapi->newBatch();
    // Fetch the current user.
      $self_request_params = array(
          'userId' => $userId,              // Person we are fetching.
          'groupId' => '@self',             // @self for one person.
          'fields' => $profile_fields       // Which profile fields to request.
      );
  $batch->add($osapi->people->get($self_request_params), 'self');

  // Fetch the friends of the user
  $friends_request_params = array(
      'userId' => $userId,              // Person whose friends we are fetching.
      'groupId' => '@friends',          // @friends for the Friends group.
      'fields' => $profile_fields,      // Which profile fields to request.
      'count' => $friend_count          // Max friends to fetch.
  );
  $batch->add($osapi->people->get($friends_request_params), 'friends');

  // Get supportedFields Request
  $batch->add($osapi->people->getSupportedFields(), 'supportedFields');

  // Send the batch request.
  $result = $batch->execute();

假设我想打印出“aboutMe”,回声是什么? cos echo $result['aboutMe'] 不起作用。

really sorry about being "totally thick today" but I have forgotten how to do something simple - too much time not in php recently.

Want to use the OS phpapi
How do I print out the individual rows - see told you I was being thick today

 // The fields we will be fetching.


 if (isset($_GET['test']) && $_GET['test'] == 'plaxo') {
    // plaxo is a PortableContacts end-point so doesn't know about the OpenSocial specific fields
    $profile_fields = array();
  } else {
    $profile_fields = array(
        'aboutMe',
        'displayName',
        'bodyType',
        'currentLocation',
        'drinker',
        'happiestWhen',
        'lookingFor'
    );
  }

// The number of friends to fetch.

  $friend_count = 2;

$batch = $osapi->newBatch();
    // Fetch the current user.
      $self_request_params = array(
          'userId' => $userId,              // Person we are fetching.
          'groupId' => '@self',             // @self for one person.
          'fields' => $profile_fields       // Which profile fields to request.
      );
  $batch->add($osapi->people->get($self_request_params), 'self');

  // Fetch the friends of the user
  $friends_request_params = array(
      'userId' => $userId,              // Person whose friends we are fetching.
      'groupId' => '@friends',          // @friends for the Friends group.
      'fields' => $profile_fields,      // Which profile fields to request.
      'count' => $friend_count          // Max friends to fetch.
  );
  $batch->add($osapi->people->get($friends_request_params), 'friends');

  // Get supportedFields Request
  $batch->add($osapi->people->getSupportedFields(), 'supportedFields');

  // Send the batch request.
  $result = $batch->execute();

Say I wanted to print out "aboutMe", whats the echo? cos echo $result['aboutMe'] doesn't work.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

傾城如夢未必闌珊 2024-09-12 14:50:53

虽然我远非 php 专家,并且诚然对您正在使用的特定产品一无所知,但我发现使用 var_dump($result) 对调试有很大帮助。

While I am far from a php expert and admittedly know nothing about the specific product you are using I find that using var_dump($result) helps a lot with debugging.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文