“WPMU Functions/get current site”的版本间的差异

来自WordPress中文文档
跳转至: 导航搜索
(1个修订)
JD55讨论
(Changing formating, marking as stub)
第1行: 第1行:
 
== Description ==
 
== Description ==
 
Returns an object containing various information relating to the site currently being viewed.
 
Returns an object containing various information relating to the site currently being viewed.
 +
 +
== Usage ==
 +
%%%<?php get_current_site(); ?>%%%
  
 
== Parameters ==
 
== Parameters ==
第6行: 第9行:
  
 
== Return Values ==
 
== Return Values ==
; tt(object)/tt : An object containing details of the site currently being viewed. Details are represented in the following public variables:
+
; <tt>(object)</tt> : An object containing details of the site currently being viewed. Details are represented in the following public variables:
  
:; id : tt(integer)/tt ID of the site currently being viewed.  
+
:; id : <tt>(integer)</tt> ID of the site currently being viewed.  
:; domain : tt(string)/tt Domain of the site currently being viewed.
+
:; domain : <tt>(string)</tt> Domain of the site currently being viewed.
:; path : tt(string)/tt Path of the site currently being viewed.
+
:; path : <tt>(string)</tt> Path of the site currently being viewed.
:; site_name : tt(string)/tt Title of the site currently being viewed.
+
:; site_name : <tt>(string)</tt> Title of the site currently being viewed.
 
 
== Usage ==
 
%%%?php get_current_site(); ?%%%
 
  
 
== Examples ==
 
== Examples ==
%%%?php
+
<pre><?php
 
$current_site = get_current_site();
 
$current_site = get_current_site();
echo 'You are viewing '.$current_site-site_name;
+
echo 'You are viewing ' . $current_site->site_name;
?%%%
+
?></pre>
%%%?php
 
echo 'You are viewing '.get_current_site()-site_name;
 
?%%%
 
  
 
----
 
----
 
+
{{Stub}}
 
[[Category:WPMU]]
 
[[Category:WPMU]]
 
[[Category:WPMU Functions]]
 
[[Category:WPMU Functions]]

2013年6月7日 (五) 19:26的版本

Description

Returns an object containing various information relating to the site currently being viewed.

Usage

%%%<?php get_current_site(); ?>%%%

Parameters

None.

Return Values

(object) 
An object containing details of the site currently being viewed. Details are represented in the following public variables:
id 
(integer) ID of the site currently being viewed.
domain 
(string) Domain of the site currently being viewed.
path 
(string) Path of the site currently being viewed.
site_name 
(string) Title of the site currently being viewed.

Examples

<?php
$current_site = get_current_site();
echo 'You are viewing ' . $current_site->site_name;
?>

includeonlydiv style=clear:both; background-color:#FAEBD7; border:1px solid #CCCCCC; color:#000000; padding:7px; margin:0.5em auto 0.5em auto; vertical-align:middle;This page is marked as incomplete. You can help Codex by expanding it./div/includeonlynoinclude

Description

This Template is used by Codex:Template Messages.

Usage

pre 检查到模板循环:模板:Message /pre

Result

检查到模板循环:模板:Message

/noinclude