1
0
mirror of https://github.com/php/doc-ru.git synced 2026-03-24 07:42:22 +01:00
Files
archived-doc-ru/reference/ftp/examples.xml
2024-10-25 12:14:26 +03:00

69 lines
2.1 KiB
XML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: 4d1c34c9b7a30cfc3a59641122c707a2812cfed7 Maintainer: shein Status: ready -->
<!-- Reviewed: no -->
<chapter xml:id="ftp.examples" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.examples;
<section xml:id="ftp.examples-basic">
<title>Простое использование</title>
<para>
<example>
<title>Пример использования FTP-функций</title>
<programlisting role="php">
<![CDATA[
<?php
// установка соединения
$ftp = ftp_connect($ftp_server);
// вход с именем пользователя и паролем
$login_result = ftp_login($ftp, $ftp_user_name, $ftp_user_pass);
// проверка соединения
if ((!$ftp) || (!$login_result)) {
echo "Не удалось установить соединение с FTP-сервером!";
echo "Попытка подключения к серверу $ftp_server была произведена под именем $ftp_user_name";
exit;
} else {
echo "Установлено соединение с FTP сервером $ftp_server под именем $ftp_user_name";
}
// закачивание файла
$upload = ftp_put($ftp, $destination_file, $source_file, FTP_BINARY);
// проверка результата
if (!$upload) {
echo "Не удалось закачать файл!";
} else {
echo "Файл $source_file закачан на $ftp_server под именем $destination_file";
}
// закрытие соединения
ftp_close($ftp);
?>
]]>
</programlisting>
</example>
</para>
</section>
</chapter>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=xml
vi: ts=1 sw=1
-->