本文整理汇总了PHP中elFinder::getStreamByUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP elFinder::getStreamByUrl方法的具体用法?PHP elFinder::getStreamByUrl怎么用?PHP elFinder::getStreamByUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类elFinder
的用法示例。
在下文中一共展示了elFinder::getStreamByUrl方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _fopen
/**
* Open file and return file pointer.
*
* @param string $path file path
* @param bool $write open file for writing
*
* @return resource|false
*
* @author Dmitry (dio) Levashov
**/
protected function _fopen($path, $mode = 'rb')
{
if ($mode === 'rb' || $mode === 'r') {
if ($file = $this->_gd_getFile($path)) {
if ($dlurl = $this->_gd_getDownloadUrl($file)) {
$token = $this->client->getAccessToken();
$access_token = '';
if (is_array($token)) {
$access_token = $token['access_token'];
} else {
if ($token = json_decode($client->getAccessToken())) {
$access_token = $token->access_token;
}
}
if ($access_token) {
$data = array('target' => $dlurl, 'headers' => array('Authorization: Bearer ' . $access_token));
return elFinder::getStreamByUrl($data);
}
}
}
}
return false;
}
示例2: _fopen
/**
* Open file and return file pointer.
*
* @param string $path file path
* @param bool $write open file for writing
*
* @return resource|false
*
* @author Dmitry (dio) Levashov
**/
protected function _fopen($path, $mode = 'rb')
{
if ($mode === 'rb' || $mode === 'r') {
list(, $itemId) = $this->_bd_splitPath($path);
$data = array('target' => self::API_URL . '/files/' . $itemId . '/content', 'headers' => array('Authorization: Bearer ' . $this->token->data->access_token));
return elFinder::getStreamByUrl($data);
}
return false;
}