當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Self::getUserId方法代碼示例

本文整理匯總了PHP中Self::getUserId方法的典型用法代碼示例。如果您正苦於以下問題:PHP Self::getUserId方法的具體用法?PHP Self::getUserId怎麽用?PHP Self::getUserId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Self的用法示例。


在下文中一共展示了Self::getUserId方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getUserInfo

 public function getUserInfo()
 {
     # Get the user id
     $userId = Self::getUserId();
     # the prepared statement
     if ($sStmt = $this->mysqli->prepare("SELECT users.id, users_social.facebook, users_social.twitter, users_social.linkedin, \n                                                  users_social.website, users_social.instagram, users_info.firstname, users_info.lastname, \n                                                    users_info.lang, files.new_name, files_extensions.extension, users_info.job_title, users_info.mobile, \n                                                      users_info.about, users.username, users_info.page_slug\n                                          FROM users_info\n                                          LEFT JOIN users on users_info.users_id = users.id\n                                          LEFT JOIN users_social on users_social.users_id = users.id\n                                          LEFT JOIN files on users_info.img = files.id\n                                          LEFT JOIN files_extensions on files.extension = files_extensions.id\n                                          WHERE users.id = ?")) {
         # bind
         $sStmt->bind_param("i", $userId);
         #execute
         $sStmt->execute();
         # bind result
         $sStmt->bind_result($id, $facebook, $twitter, $linkedin, $website, $instagram, $firstname, $lastname, $lang, $new_name, $extension, $job_title, $mobile, $about, $username, $page_slug);
         //fetch it
         if ($sStmt->fetch()) {
             $result = array('id' => $id, 'facebook' => $facebook, 'twitter' => $twitter, 'linkedin' => $linkedin, 'website' => $website, 'instagram' => $instagram, 'firstname' => $firstname, 'lastname' => $lastname, 'lang' => $lang, 'new_name' => $new_name, 'extension' => $extension, 'job_title' => $job_title, 'mobile' => $mobile, 'about' => $about, 'username' => $username, 'page_slug' => $page_slug);
         }
         // echo "<pre>";
         // var_dump($result);
         // exit;
         return $result;
     }
 }
開發者ID:RhenusoneRosalia,項目名稱:portfolio,代碼行數:22,代碼來源:User.php


注:本文中的Self::getUserId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。