Coding:How to fetch user profile data with SSI.php from a SMF forum database รหัส: วิธีการเรียกข้อมูลโปรไฟล์ผู้ใช้กับ SSI.php จากฐานข้อมูลเวที SMF
Posted on 20. โพสต์ใน 20. Jul, 2009 by Dragos in Coding , MySQL , PHP ก.ค., 2,009 โดย Dragos ใน การเข้ารหัส, MySQL, PHP
Even though SMF offers a way to integrate their forum into any website, they do not provide enough information on how to do some basic tasks, eg fetching a member's profile details from the database. แม้ว่า SMF เสนอวิธีการรวมประชุมของพวกเขาในเว็บไซต์ที่พวกเขาไม่ได้ให้ข้อมูลเพียงพอในการดำเนินงานพื้นฐานเช่นเรียกรายละเอียดข้อมูลของสมาชิกจากฐานข้อมูล. Fortunately, Netbeans has a very helpful feature, the code Navigator which shows an instant preview of all functions available in an open file. โชคดีที่ Netbeans มีคุณสมบัติที่มีประโยชน์มากรหัส Navigator ที่แสดงตัวอย่างทันทีหน้าที่ทั้งหมดที่มีอยู่ในไฟล์เปิด. So finding the function which does our job was pretty easy (though I couldn't find it on SMF's website). เพื่อหางานที่จะทำงานของเราง่ายสวย (แม้ว่าฉันไม่สามารถค้นหาได้ในเว็บไซต์ของ SMF).
Anyway, to fetch data from the SMF database, using SMF's functions, we need to include SSI.php into our website. ต่อไปเรียกข้อมูลจากฐาน SMF ใช้ฟังก์ชัน SMF ของเราต้องรวม SSI.php ในเว็บไซต์ของเรา.
include_once('path/to/your/forum/SSI.php'); // replace path/to/your/forum with your path to the SMF forum เส้นทาง include_once ( '/ เพื่อ / ประชุม / ท่าน / SSI.php'); / / เปลี่ยนเส้นทาง / เพื่อ / ประชุม / กับเส้นทางของท่านไปประชุม SMF $userData=ssi_fetchMember(1,''); //ssi_fetchMember() takes two parameters: first: the member id as an integer or more than one id passed in an array; second parameter: output method as string: 'echo' or ''; $ userData = ssi_fetchMember (1 ,''); / ssi_fetchMember () ใช้เวลาสองพารามิเตอร์: ครั้งแรก: สมาชิก id เป็นจำนวนเต็มหรือมากกว่าหนึ่งรหัสผ่านในอาร์เรย์; พารามิเตอร์ที่สอง: วิธีการออกเป็นสาย: 'echo' หรือ ''; print_r($userData); //display the array containing the member's profile data print_r ($ userData) / / แสดงแถวที่มีข้อมูลส่วนตัวของสมาชิก
Related posts: บทความที่เกี่ยวข้อง:












































