您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

小型 Twitter 的系统 流碼+註釋,PHP

2024/5/29 16:55:43发布20次查看
小型 twitter 的系统 源碼+註釋,php
?
今天重新吧 小型twitter系統的源碼 認真研究了一邊 算是熟悉php把?
爲今後一個月的畢業設計做打算
?
下載
http://dl.vmall.com/c0nkwafdqz
?
index
?
microblogging application see list of users
your status:
$list ) { echo \n; echo . $list ['userid'] . \n; echo . $list ['body'] .
\n; echo . $list ['stamp'] . \n; echo
\n; } ?>
you haven't posted anything yet!
users you're following $value ) { echo . $value . \n; } ?> you're not following anyone yet!

headers
?
?

users
microblogging application - users list of users $value ) {//=>指的是获取数组内某一个单元内的元素的内容, echo \n; echo . $key . \n;//顯示id echo . $value;//顯示id對應的值也就是value if (in_array ( $key, $following )) {//檢查key是否在following中 然后根据状态显示不同的值显示不同的信息 生成不同的指向action的链接 echo unfollow ; } else { echo follow ; } echo \n; echo
\n; } ?>
there are no users in the system!

?
?
0) { $extra = limit $limit; } else { $extra = ''; } $sql = select user_id,body, stamp from posts where user_id in ($user_string) order by stamp desc $extra; echo $sql; $result = mysql_query ( $sql ); while ( $data = mysql_fetch_object ( $result ) ) { $posts [] = array ( 'stamp' => $data->stamp, 'userid' => $data->user_id, 'body' => $data->body ); } return $posts;}/** * 显示用户 * 如果user_id =0,直接显示所有用户 * 如果user id >0,显示改用户follow的用户id * @param unknown_type $user_id * @return multitype:|multitype:null */function show_users($user_id = 0) { if ($user_id > 0) { $follow = array (); $fsql = select user_id from following where follower_id='$user_id';//從follow中選出該id的follower $fresult = mysql_query ( $fsql ); while ( $f = mysql_fetch_object ( $fresult ) ) {//把結果作爲一個對象傳入 array_push ( $follow, $f->user_id );//把f中的user_id字段放到follow中 } if (count ( $follow )) { $id_string = implode ( ',', $follow );//以,作爲分割符來加工這個字符串,爲了拼接後面的sql $extra = and id in ($id_string); } else { return array (); } } $users = array (); $sql = select id, username from users where status='active' $extra order by username;//從user表中選出follower的 id 和 name $result = mysql_query ( $sql ); while ( $data = mysql_fetch_object ( $result ) ) { $users [$data->id] = $data->username;//想user中填入用戶名 } return $users;}/** * 搜索出用户follow的用户的id * @param unknown_type $userid * @return multitype: */function following($userid) { $users = array (); $sql = select distinct user_id from following where follower_id = '$userid'; $result = mysql_query ( $sql ); while ( $data = mysql_fetch_object ( $result ) ) { array_push ( $users, $data->user_id ); } return $users;}function check_count($first, $second) { $sql = select count(*) from following where user_id='$second' and follower_id='$first'; $result = mysql_query ( $sql ); $row = mysql_fetch_row ( $result ); return $row [0];}function follow_user($me, $them) { $count = check_count ( $me, $them ); if ($count == 0) { $sql = insert into following (user_id, follower_id) values ($them,$me); $result = mysql_query ( $sql ); }}function unfollow_user($me, $them) { $count = check_count ( $me, $them ); if ($count != 0) { $sql = delete from following where user_id='$them' and follower_id='$me' limit 1; $result = mysql_query ( $sql ); }}?>
add
?
?


该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product