本文整理汇总了PHP中Gateway::app方法的典型用法代码示例。如果您正苦于以下问题:PHP Gateway::app方法的具体用法?PHP Gateway::app怎么用?PHP Gateway::app使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gateway
的用法示例。
在下文中一共展示了Gateway::app方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: afterControllerAction
/**
* The post-filter for controller actions.
* This method is invoked after the currently requested controller action and all its filters
* are executed. If you override this method, make sure you call the parent implementation at the end.
* @param CController $controller the controller
* @param CAction $action the action
*/
public function afterControllerAction($controller, $action)
{
if (($parent = $this->getParentModule()) === null) {
$parent = Gateway::app();
}
$parent->afterControllerAction($controller, $action);
}
示例2: xSendFile
public function xSendFile($filePath, $options = array())
{
if (!isset($options['forceDownload']) || $options['forceDownload']) {
$disposition = 'attachment';
} else {
$disposition = 'inline';
}
if (!isset($options['saveName'])) {
$options['saveName'] = basename($filePath);
}
if (!isset($options['mimeType'])) {
if (($options['mimeType'] = CFileHelper::getMimeTypeByExtension($filePath)) === null) {
$options['mimeType'] = 'text/plain';
}
}
if (!isset($options['xHeader'])) {
$options['xHeader'] = 'X-Sendfile';
}
if ($options['mimeType'] !== null) {
header('Content-Type: ' . $options['mimeType']);
}
header('Content-Disposition: ' . $disposition . '; filename="' . $options['saveName'] . '"');
if (isset($options['addHeaders'])) {
foreach ($options['addHeaders'] as $header => $value) {
header($header . ': ' . $value);
}
}
header(trim($options['xHeader']) . ': ' . $filePath);
if (!isset($options['terminate']) || $options['terminate']) {
Gateway::app()->end();
}
}