���� ������
������� ������ ���������� ����� PHP, ������� �������� ������� php-������� � ������� (PHP CLI) � ����� Web, �������� ������ ��������� ������ � ������� �������� kappa.cs.karelia.ru.
�������� ������
�1. ����� 1.
���������� php-������ simple_start.phps (utf8) (��� ���������� - simple_start) � ���� ������� ���������� ��
kappa.cs.karelia.ru. ��������� ���������� �� php. ����������� ��� �������� ������� php-���������� ��
��������� ������. ������ ������� - ����� ������� php
:~> php simple_start.php
������� �������� ������ -v, -w, -l, -m, -h (��������, � man php).
������ ������� - ��� ����������� ����. ��� ����� ����� � ������ ������� �������
���� � ���������� ������ php (#!/usr/bin/php) � �������� ����� ����� �� ���������� (chmod u+x).
:~> ./simple_start.php
�������� ��� �������� (echo $?), ������� ���������� � ������������ ������� � ������
�������� ������ �������, ��� ������� ������. �������� ��� ��������
�� ����� ����� 0-255 (��������, exit(45);).
�1. ����� 2.
�������� php-��������, ����������� ������� html-������� ��� ������� ��������� �������. � ������� ������ ���� ��� �������: 1 - ����� �������; 2 - ������� ; 3 - ���������. ������� ������� - ��� ��������������� ������� php. ��������� - ��������� ���������� ��������������� ������ �� ������� �������. ����� ����� ��������� � ����������� ������� + ������-���������. ������ ������� ����� ���� ������������. ��������� ����� �� ������ �������� �� ������� ������� ������� ���� ��������. ����������� ������ ��� ���������� ������� ���������� � ����� simple_start.php. (��� ������� �������� ����� ������� ���������� ��� ��������� � ������� public_html.)
# | ������� |
---|---|
1 | ������� �������� ���������� $a, $fl, $boo, $str |
2 | ������� ��������� �������� ���������� $a � $str |
3 | ������� ��������� ��������� ���������� $a � $str � ������� ���������� >, <, ==, === |
4 | ������� ��������� ��������� ���������� $nol � $pusto � �������������� ���������� == � === |
5 | �������� ��������� ������ ���������� $s1 � $s2 |
6 | ������� $mas["one"], $mas[2], $mas[3] |
7 | � ������� var_dump() ������� ������ $mas |
8 | ������� �������������� � ������ ������� $mas |
9 | ������� �������� ���������� $a, ��������� ��������� "���������� ����������". ��� ����� ����� ������� ����� ���������� $name = "a". ������� ${$name} |
10 | �������� �������� ���������� $a, ��������� "���������� �� ������". ������� $a. ��� ����� ����� ������� ����� ���������� $ref=&$a, ������� �������� ������� �� ���������� $a. ������, ����� �������� �������� � $a, ���������� ��������� $ref ����� �������� � ������� $a |
11 | ������� �������� ��������� HOST |
12 | ������� ������ ������ � ������� ����������. ����� ��������������� ���������� ����������� ������� shell $file_list=`ls -a`. ������� �������� $file_list |
13 | ��� ���������� $srt � $nol ������� ��������� ���������� ��������� $str.$nol +1. �������� ��������� ����� �������, ����� � ���������� ���������� "string01" |
14 | � �������������� ���������������� �������� (magic constants) ������������ ����������� �� ������� �������� (<a href= ...). ��� ��������� ����� �������� ����� ����� ��������������� �������� basename(). ������� ����� ������� ������ �������. |
15 | ������� ������������� ������ $colours, ��������� �� ���� ���������. ��������� ������ �������� �������: "������ ������� ������ ����� ��� ����� �����", �������� ��������� ������� - ��������������� �����. ������������� �������� ������� $colours � ������� ����������� � ����������� ������. ��������� �������� foreach ������� �������� ������� $colours � html-������� (2 ������, 7 ��������). |
16 | �������� ������� f_color, ������� ��������� ������������� �������� � ������� ������ "������ �����" �������� �����, ���� �������� ����� � ������ "�������� �����" �������� ����� �����. ���������� ������������� �������� �� ���������. ������� ������� � ������ � �������� ����������, � ����� ��� ���������. |
������ �������� �������
var_dump(), gettype(), settype(), unset(), echo, print, printf(), strval(), phpinfo(), define(), constant(), get_defined_constants()