<?php
namespace framework\web;
abstract class Api extends Controller
{
protected $_responseData = [];
protected function afterInit()
{
}
protected function init()
{
parent::init(); $this->header->noCache();
$this->header->contentType('json');
$this->afterInit();
}
protected function assign($key, $value = null)
{
$this->_responseData[$key] = $value;
}
protected function display($path = '')
{
return $this->_responseData;
}
public function after($data = [])
{
if (!\is_array($data))
{
$data = array($data);
}
return $data;
}
}