WIKI使用導(dǎo)航
站長(zhǎng)百科導(dǎo)航
站長(zhǎng)專題
- 網(wǎng)站推廣
- 網(wǎng)站程序
- 網(wǎng)站賺錢
- 虛擬主機(jī)
- cPanel
- 網(wǎng)址導(dǎo)航專題
- 云計(jì)算
- 微博營(yíng)銷
- 虛擬主機(jī)管理系統(tǒng)
- 開放平臺(tái)
- WIKI程序與應(yīng)用
- 美國(guó)十大主機(jī)
WordPress: WPMU Functions/get blog post:修訂間差異
來自站長(zhǎng)百科
(新頁面: Get Blog Post returns an object of the requested post. == The Function == function get_blog_post( $blog_id, $post_id ) { global $wpdb; $key = $blog_id."-".$post_id."-blog_post"; ...) ? |
無編輯摘要 ? |
||
第1行: | 第1行: | ||
Get Blog Post returns an object of the requested post. | Get Blog Post returns an object of the requested post. | ||
得到博客溫州,返回查詢的文章的object。 | |||
== The Function == | == The Function == | ||
== 函數(shù) == | |||
? function get_blog_post( $blog_id, $post_id ) { | ? function get_blog_post( $blog_id, $post_id ) { | ||
?? global $wpdb; | ?? global $wpdb; | ||
第11行: | 第17行: | ||
?? return $post; | ?? return $post; | ||
? } | ? } | ||
function get_blog_post( $blog_id, $post_id ) { | |||
? global $wpdb; | |||
? $key = $blog_id."-".$post_id."-blog_post"; | |||
? $post = wp_cache_get( $key, "site-options" ); | |||
? if( $post == false ) { | |||
? ? $post = $wpdb->get_row( "SELECT * FROM {$wpdb->base_prefix}{$blog_id}_posts WHERE ID = '{$post_id}'" ); | |||
? ? wp_cache_add( $key, $post, "site-options", 120 ); | |||
? } | |||
? return $post; | |||
} | |||
== The Returned Post == | == The Returned Post == | ||
==已返回的文章 == | |||
? stdClass Object | ? stdClass Object | ||
? ( | ? ( | ||
第45行: | 第71行: | ||
Return to [[WordPress:WPMU_Functions]] | Return to [[WordPress:WPMU_Functions]] | ||
stdClass Object | |||
( | |||
? ? [ID] => 5 | |||
? ? [post_author] => 3 | |||
? ? [post_date] => 2008-07-06 14:38:58 | |||
? ? [post_date_gmt] => 2008-07-06 21:38:58 | |||
? ? [post_content] => [raw input text of the post] | |||
? ? [post_title] => [title] | |||
? ? [post_category] => 0 | |||
? ? [post_excerpt] => | |||
? ? [post_status] => publish | |||
? ? [comment_status] => open | |||
? ? [ping_status] => open | |||
? ? [post_password] => | |||
? ? [post_name] => 5 | |||
? ? [to_ping] => | |||
? ? [pinged] => | |||
? ? [post_modified] => 2008-07-06 14:39:20 | |||
? ? [post_modified_gmt] => 2008-07-06 21:39:20 | |||
? ? [post_content_filtered] => | |||
? ? [post_parent] => 0 | |||
? ? [guid] => <nowiki>http://mu.samplesite.net/exampleblog/?p=[ID]</nowiki> | |||
? ? [menu_order] => 0 | |||
? ? [post_type] => post | |||
? ? [post_mime_type] => | |||
? ? [comment_count] => 0 | |||
) | |||
--[[WordPress:User:Unifex|Unifex]] 2008年7月6日,21:57 (UTC) | |||
---- | |||
返回到 [[WordPress:WPMU_Functions| WPMU_Functions]] |
2008年9月26日 (五) 15:15的最新版本
Get Blog Post returns an object of the requested post.
得到博客溫州,返回查詢的文章的object。
The Function[ ]
函數(shù)[ ]
function get_blog_post( $blog_id, $post_id ) { global $wpdb; $key = $blog_id."-".$post_id."-blog_post"; $post = wp_cache_get( $key, "site-options" ); if( $post == false ) { $post = $wpdb->get_row( "SELECT * FROM {$wpdb->base_prefix}{$blog_id}_posts WHERE ID = '{$post_id}'" ); wp_cache_add( $key, $post, "site-options", 120 ); } return $post; }
function get_blog_post( $blog_id, $post_id ) {
global $wpdb; $key = $blog_id."-".$post_id."-blog_post"; $post = wp_cache_get( $key, "site-options" ); if( $post == false ) { $post = $wpdb->get_row( "SELECT * FROM {$wpdb->base_prefix}{$blog_id}_posts WHERE ID = '{$post_id}'" ); wp_cache_add( $key, $post, "site-options", 120 ); } return $post; }
The Returned Post[ ]
已返回的文章[ ]
stdClass Object ( [ID] => 5 [post_author] => 3 [post_date] => 2008-07-06 14:38:58 [post_date_gmt] => 2008-07-06 21:38:58 [post_content] => [raw input text of the post] [post_title] => [title] [post_category] => 0 [post_excerpt] => [post_status] => publish [comment_status] => open [ping_status] => open [post_password] => [post_name] => 5 [to_ping] => [pinged] => [post_modified] => 2008-07-06 14:39:20 [post_modified_gmt] => 2008-07-06 21:39:20 [post_content_filtered] => [post_parent] => 0 [guid] => http://mu.samplesite.net/exampleblog/?p=[ID] [menu_order] => 0 [post_type] => post [post_mime_type] => [comment_count] => 0 )
--Unifex 21:57, 6 July 2008 (UTC)
Return to WordPress:WPMU_Functions
stdClass Object
( [ID] => 5 [post_author] => 3 [post_date] => 2008-07-06 14:38:58 [post_date_gmt] => 2008-07-06 21:38:58 [post_content] => [raw input text of the post] [post_title] => [title] [post_category] => 0 [post_excerpt] => [post_status] => publish [comment_status] => open [ping_status] => open [post_password] => [post_name] => 5 [to_ping] => [pinged] => [post_modified] => 2008-07-06 14:39:20 [post_modified_gmt] => 2008-07-06 21:39:20 [post_content_filtered] => [post_parent] => 0 [guid] => http://mu.samplesite.net/exampleblog/?p=[ID] [menu_order] => 0 [post_type] => post [post_mime_type] => [comment_count] => 0 )
--Unifex 2008年7月6日,21:57 (UTC)
返回到 WPMU_Functions