本文整理汇总了PHP中http::contentType方法的典型用法代码示例。如果您正苦于以下问题:PHP http::contentType方法的具体用法?PHP http::contentType怎么用?PHP http::contentType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类http
的用法示例。
在下文中一共展示了http::contentType方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: desc
public function desc($id)
{
ControllerTray::instance()->renderLayout = false;
http::contentType('application/json');
$this->data->id = $id;
$this->data->info = new \ROM\BongUserData();
$this->data->info->load($id . '.usr');
}
示例2: execute
public function execute()
{
http::freeze();
//a Spirit Cannot send any HTTP Header unless It is used as ResponseService
$this->engine->executeLogic();
http::release();
http::contentType('application/json');
return json_encode($this->engine->xdo());
}
示例3: execute
public function execute()
{
http::freeze();
//a Spirit Cannot send any HTTP Header unless It is used as ResponseService
$this->engine->run();
http::release();
http::contentType('text/xml');
return $this->engine->xdo()->toXML()->saveXML();
}
示例4: main
public function main($name = null, $age = null)
{
http::contentType('text/html');
$this->bootStrapJs();
if (!$this->cached() || $name) {
$this->xdo->name = $name;
}
if (!$this->cached() || $age) {
$this->xdo->age = $age;
}
//$this->switchView('alternateView');
}
示例5: execute
public function execute()
{
http::freeze();
//a Spirit Cannot send any HTTP Header unless It is used as ResponseService
$this->engine->run();
http::release();
$xdo = $this->engine->xdo();
$navigation = $this->engine->getNavigation();
if (isset($xdo->{$navigation->propertyName})) {
$value = $xdo->{$navigation->propertyName};
if (is_array($value) || is_object($value)) {
http::contentType('application/json');
return json_encode($value);
} else {
http::contentType('text/plain');
return $value;
}
}
return null;
}
示例6: url
@import url("<?php
echo $css;
?>
");
<?php
}
?>
</style>
</head>
<body>
<div id="bong-admin-header">
<input type="text" name="search" class="bong-admin-doc-search" value="Search" />
<a href="<?php
echo Resource::link();
?>
/user/logout" class="bong-admin-header-cntrl">Logout</a>
<a href="#" class="bong-admin-header-cntrl">Settings</a>
<a href="#" class="bong-admin-home">bong</a>
</div>
<div id="bong-admin-body">
<?php
echo $this->viewContents;
?>
</div>
<div id="bong-admin-editor-minimize-area"></div>
</body>
</html>
<?php
http::contentType('text/html');
示例7: createControllerMethodParams
public function createControllerMethodParams($methodName)
{
$backend = null;
if (Backend::ExistsUnSessioned('explorer.' . $this->xdo->project->name)) {
$explorer = Backend::LoadUnSessioned('explorer.' . $this->xdo->project->name);
} else {
$explorer = Structs\Admin\Project::create($this->xdo->project->name);
/*Create From reflection*/
}
$this->data->controllerName = $this->xdo->controllerName;
$controller = $explorer->controllerByName($this->xdo->controllerName);
$this->data->controller = $controller;
ControllerTray::instance()->renderLayout = false;
http::contentType('application/json');
$method = $controller->methodByName($methodName);
$this->data->methodName = $methodName;
$this->data->success = false;
$this->data->success = $method->genParams();
//Backend::saveUnSessioned('explorer.'.$this->xdo->project->name, $explorer);
}
示例8: run
//.........这里部分代码省略.........
* main:
* require(paramPath())
* require(controllerPath())
* startOutputBuffering()
* $controller = new Controller();
* closure syncVars(&$controller){
* foreach($controller->data as $key => &$value){
* local $key = $value;
* }
* processView()
* }
* $this->viewContents = getOutputBufferContents()
* endOutputBuffering()
* startOutputBuffering()
* require(layoutPath())
* $response = getOutputBufferContents()
* endOutputBuffering()
*
* \endalgorithm
*/
public function run()
{
$controller = $this->executeLogic();
//$this->storeXDO($controller->xdo);
//{ Make Variables Accessible to View
$data = $controller->data;
if (isset($controller->xdo)) {
$xdo = $controller->xdo;
}
if (isset($controller->session)) {
$session = $controller->session;
}
$meta = $controller->meta;
//}
//{ Load The View
if (ControllerTray::instance()->renderView) {
if (isset($this->_methodReturn) && is_int($this->_methodReturn) && $this->_methodReturn == -1) {
return;
}
$__viewName = $this->view();
ob_start();
$scope = function () use($__viewName, $controller, $data, $session, $xdo, $meta) {
require $__viewName;
};
$scope();
$this->viewContents = ob_get_contents();
ob_end_clean();
if (ControllerTray::instance()->bongParsing) {
$parser = new \SuSAX\Parser(new BongParser(function ($spiritName, $methodName, $arguments, $tagName, $instanceId = null) use($controller) {
switch ($tagName) {
case 'spirit':
return !$instanceId ? $controller->spirit($spiritName)->call($methodName, $arguments) : $controller->spirit($spiritName)->instance($instanceId)->call($methodName, $arguments);
break;
}
}));
$parser->setNsFocus('bong');
$parser->setText($this->viewContents);
$this->viewContents = $parser->parse();
}
if ($this->_systemView) {
$controller->dumpStrap();
}
}
//}
if (ControllerTray::instance()->renderView && ControllerTray::instance()->renderLayout) {
/// < Layout cannot be rendered If no View is rendered
$this->mergeParams();
$params = $this->_arrangedParams;
ob_start();
require $this->layout();
$this->responseBuffer = ob_get_contents();
ob_end_clean();
} else {
if (ControllerTray::instance()->renderView) {
$this->responseBuffer = ControllerTray::instance()->trim ? trim($this->viewContents) : $this->viewContents;
} else {
if (isset($this->_methodReturn)) {
switch (ControllerTray::instance()->responseType) {
case 'scrap/xml':
http::contentType('text/xml');
$packer = new XMLPacker($this->_methodReturn);
$this->responseBuffer = $packer->toXML()->saveXML();
break;
case 'scrap/json':
http::contentType('application/json');
$this->responseBuffer = json_encode($this->_methodReturn);
break;
case 'scrap/plain':
default:
http::contentType('text/plain');
$this->responseBuffer = $this->_methodReturn;
}
}
}
}
if (ControllerTray::instance()->xsltView) {
$this->processXSLView($controller->storage());
}
//echo $this->responseBuffer;
}
示例9: run
public function run()
{
if (Fstab::instance()->projectExists($this->projectName)) {
$projectDir = Path::instance()->evaluate(':' . $this->projectName);
if (is_dir($projectDir)) {
$evPath = $this->navigation->systemResource ? '' : ":{$this->projectName}.";
$evPath .= "share.";
switch ($this->navigation->resourceType) {
case 'img':
$evPath .= 'image';
break;
case 'css':
$evPath .= 'css';
break;
case 'js':
$evPath .= 'javascript';
break;
case 'xslt':
$evPath .= 'xslt';
break;
case 'scrap':
$evPath .= 'scrap';
break;
default:
}
$evPath .= ".@{$this->navigation->estimatedContentName}";
$resourcePath = Path::instance()->evaluate($evPath);
if (is_file($resourcePath)) {
$mime = mime_content_type($resourcePath);
switch ($this->navigation->resourceType) {
case 'img':
http::contentType($mime);
break;
case 'css':
http::contentType('text/css');
break;
case 'js':
http::contentType('text/javascript');
break;
case 'xslt':
http::contentType('text/xml+xslt');
break;
case 'scrap':
http::contentType('text/plain');
break;
default:
}
switch ($this->navigation->resourceType) {
case 'img':
$this->responseBuffer = file_get_contents($resourcePath);
break;
default:
ob_start();
require $resourcePath;
$this->responseBuffer = ob_get_contents();
ob_end_clean();
}
} else {
throw new FileNotFoundException($resourcePath ? $resourcePath : 'null <Resource Path Could not be Resolved> ');
}
} else {
throw new ProjectDirNotFoundException($this->projectName);
}
} else {
throw new ProjectNotFoundException($this->projectName);
}
}