本文整理匯總了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;
}