What does @ mean in a string PHP? (Not the error suppression operator) [duplicate]
Possible Duplicate:
@ (at sign) in drupal
I know that sometimes it has to do with error suppression but I'm looking at Drupal code and I can't recognize the syntax:
Example 1:
$batch = array(
'operations' => $operat开发者_JAVA技巧ions,
'finished' => '_install_profile_batch_finished',
'title' => st('Installing @drupal', array('@drupal' => drupal_install_profile_name())),
'error_message' => st('The installation has encountered an error.'),
);
Example 2:
drupal_set_title(st('@drupal installation complete', array('@drupal' => drupal_install_profile_name())));
Example 3:
$output .= '<p>'. (isset($messages['error']) ? st('Please review the messages above before continuing on to <a href="@url">your new site</a>.', array('@url' => url(''))) : st('You may now visit <a href="@url">your new site</a>.', array('@url' => url('')))) .'</p>';
This hasn't to do with php, but with drupal. @drupal
is a variable used by the templating engine drupal uses.
This is Drupal specific, it means the variable is run through check_plain, which escapes HTML characters (Relevant Drupal API documentation).
The t() and st() functions are used for translatable strings.
It is part of the drupal template engine. This is a flag for a replacement variable.
精彩评论