2014-02-24 51 views

回答

0

沒有爲Drupal 7 drupal_goto(),您可以使用剛剛加入一個參數會喜歡這個

drupal_goto($網址,陣列重定向Drupal內部路徑也還有外部鏈接的功能(」外部'=> TRUE));

請對API文檔來看看這個功能

drupal_goto($path = '', array $options = array(), $http_response_code = 302)

說明: $選項:(可選)的附加選項關聯數組包含下列元素:

'query':一組查詢鍵/值對(不包括任何 URL編碼)附加到URL。

'fragment': A fragment identifier (named anchor) to append to the 
URL. Do not include the leading '#' character. 

'absolute': Defaults to FALSE. Whether to force the output to be an 
absolute link (beginning with http:). Useful for links that will be 
displayed outside the site, such as in an RSS feed. 

'alias': Defaults to FALSE. Whether the given path is a URL alias 
already. 

'external': Whether the given path is an external URL. 

'language': An optional language object. If the path being linked to 
is internal to the site, $options['language'] is used to look up the 
alias for the URL. If $options['language'] is omitted, the global 
$language_url will be used. 

'https': Whether this URL should point to a secure location. If not 
defined, the current scheme is used, so the user stays on HTTP or 
HTTPS respectively. TRUE enforces HTTPS and FALSE enforces HTTP, but 
HTTPS can only be enforced when the variable 'https' is set to TRUE. 

'base_url': Only used internally, to modify the base URL when a 
language dependent URL requires so. 

'prefix': Only used internally, to modify the path when a language 
dependent URL requires so. 

'script': The script filename in Drupal's root directory to use when 
clean URLs are disabled, such as 'index.php'. Defaults to an empty 
string, as most modern web servers automatically find 'index.php'. 
If clean URLs are disabled, the value of $path is appended as query 
parameter 'q' to $options['script'] in the returned URL. When 
deploying Drupal on a web server that cannot be configured to 
automatically find index.php, then hook_url_outbound_alter() can be 
implemented to force this value to 'index.php'. 

'entity_type': The entity type of the object that called url(). Only 
set if url() is invoked by entity_uri(). 

'entity': The entity object (such as a node) for which the URL is 
being generated. Only set if url() is invoked by entity_uri(). 

$ http_response_code:(可選)HTTP狀態代碼,用來重定向,默認爲302的3xx重定向狀態代碼的有效值在RFC 2616和新的HTTP狀態代碼的定義草案:

301:永久移動(大多數重定向的推薦值)。

302:找到(默認在Drupal和PHP中,有時用於垃圾郵件搜索引擎)。

303:查看其他。

304:未修改。

305:使用代理。

307:臨時重定向。

請讓我知道如果我錯過了任何東西。