字符串分割成数组——PHP

$email = explode(",", $params['headers']['Bcc'] );
      $connection = \Drupal::database();
      $u_name = '';
      $u_id = '';
      $u_roles = '';
      foreach ($email as $key => $value) {
          $query = $connection->select('users_field_data', 'u');
          $query->join('user__roles', 'roles', 'roles.entity_id = u.uid');
          $query->condition('u.mail', $value, '=');
          $query->fields('u', array('uid','name'));
          $query->fields('roles', array('roles_target_id'));
          $result= $query->execute()->fetch();
          $u_name .= $result->name . ',';
          $u_id .= $result->uid . ',';
          $u_roles .= $result->roles_target_id . ',';
      }
        $u_name_new = rtrim($u_name, ',');
        $u_id_new = rtrim($u_id, ',');
        $u_roles_new = rtrim($u_roles, ',');

 

上一篇:ansible-roles


下一篇:java – Spring引导如何使用jwt管理用户角色