Содержимое урока закрыто для просмотра. Что бы получить доступ к уроку необходимо зарегистрироваться и подать заявку на курс.
| ↑ 7. Готовые решения | ||||
| Урок 7.1. Как отдать пользователю файл в Drupal 6 |
||||
| ← | Предыдущий урок 7. Готовые решения |
Следующий урок → 17. Права пользователей в Drupal 6.
|
||
**** ** ****** ***** *** *************. ******** ********** *** ********* *****, ***** *****, ***********, ******, *********.
Drupal ******* ** PHP * *** ******* * *********** ***** PHP ******** Drupal-*************.
****** PHP *** ***** ********* ***:
$fileName = 'ramech.net.txt';
header('Content-Disposition: attachment; filename='.basename($fileName));
header('Content-Type: text/plain');
readfile($fileName);
exit();
****** ****** ******** ********** ********** ***** "ramech.net.txt". ******** ********, *** ****** **********. *** ****** ***** ****** ***** ****** *** ********* ** ***************:
header('Content-Type: *********/****');
* Drupal **********:
/**
* ********** hook_menu()
*/
function ramechnet_menu()
{
$items['download'] = array(
'title' => 'Download',
'page callback' => 'ramechnet_download_page',
'access arguments' => array('administer site configuration'),
);
return $items;
}
/**
* ******** **********
*/
function ramechnet_download_page()
{
$fileName = 'ramech.net.txt';
header('Content-Disposition: attachment; filename='.basename($fileName));
header('Content-Type: text/plain');
readfile($fileName);
exit;
}| ↑ 7. Готовые решения | ||||
| Урок 7.1. Как отдать пользователю файл в Drupal 6 |
||||
| ← | Предыдущий урок 7. Готовые решения |
Следующий урок → 17. Права пользователей в Drupal 6.
|
||