PHP Kézikönyv

Stig Sćther Bakken
Alexander Aulbach
Egon Schmid
Jim Winstead
Lars Torben Wilson
Rasmus Lerdorf
Zeev Suraski
Andrei Zmievski

Szerkesztette

Stig Sćther Bakken

Egon Schmid

Fordítók:
Hojtsy Gábor
Kontra Gergely
Varanka Zoltán
Másképpen segített:
Jouni Ahto

Tartalom
Előszó
A kézikönyvről
I. Első lépések
1. Az első PHP oldal
2. Telepítés
3. Konfiguráció
4. Biztonság
II. A nyelv alapjai
5. Alapvető szintaxis
6. Típusok
7. Változók
8. Konstansok
9. Kifejezések
10. Operátorok
11. Vezérlési szerkezetek
12. Függvények
13. Osztályok és objektumok
III. Szolgáltatások
14. Hibakezelés
15. Képek készítése
16. HTTP hitelesítés PHP-vel
17. Cookie-k [Sütik :-)]
18. Filefeltöltés kezelése
19. Távoli file-ok kezelése
20. Kapcsolatkezelés
21. Állandó (persistent) adatbázis kapcsolatok
IV. Függvény referencia
I. Apache-specifikus függvények
II. Aspell függvények
III. BCMath tetszőleges pontosságú matematikai függvények
IV. ClibPDF függvények
V. COM támogató függvények Windowshoz
VI. CURL, Client URL Library függvények
VII. Cybercash payment függvények
VIII. Dátum és idő függvények
IX. dBase függvények
X. DBM függvények
XI. DBM-típusú adatbázis absztrakciós függvények
XII. Dinamikus betöltés függvények
XIII. DOM XML függvények
XIV. filePro függvények
XV. File-rendszer függvények
XVI. Forms Data Format függvények
XVII. FTP függvények
XVIII. GNU Gettext
XIX. Hálózatkezelő függvények
XX. HTTP függvények
XXI. Hyperwave függvények
XXII. ICAP függvények
XXIII. IMAP, POP3 és NNTP függvények
XXIV. Informix függvények
XXV. InterBase függvények
XXVI. Képmanipuláló függvények
XXVII. Könyvtárkezelő függvények
XXVIII. LDAP függvények
XXIX. Mail függvények
XXX. Máshova nem sorolható függvények
XXXI. Matematikai függvények
XXXII. MCAL függvények
XXXIII. Mcrypt tirkosító függvények
XXXIV. Mhash függvények
XXXV. Microsoft SQL Server függvények
XXXVI. mSQL függvények
XXXVII. MySQL függvények
XXXVIII. Naptár függvények
XXXIX. ODBC függvények
XL. Oracle függvények
XLI. Oracle 8 függvények
XLII. Osztály/Objektum függvények
XLIII. PDF függvények
XLIV. PHP opciók és információk
XLV. POSIX függvények
XLVI. PostgreSQL függvények
XLVII. Programfuttató függvények
XLVIII. Pspell függvények
XLIX. GNU Readline függvények
L. GNU Recode függvények
LI. Reguláris kifejezés függvények (Perl-kompatibilis)
LII. Reguláris kifejezés függvények (POSIX extended)
LIII. Session kezelő függvények
LIV. Shockwave Flash függvények
LV. SNMP függvények
LVI. String függvények
LVII. Sybase függvények
LVIII. Szemafor és megosztott memória függvények
LIX. Tömb függvények
LX. URL függvények
LXI. Változókkal kapcsolatos függvények
LXII. Verisign Payflow Pro függvények
LXIII. Vmailmgr függvények
LXIV. WDDX függvények
LXV. XML elemző függvények
LXVI. YAZ függvények
LXVII. YP/NIS függvények
LXVIII. Zlib tömörítő függvények
V. Függelékek
A. Áttérés PHP/FI 2.0-ról PHP 3.0-ra
B. A PHP fejlesztése
C. A PHP Debugger
Táblázatok listája
2-1. PHP Modulok Windows alatt
3-1. Hibajelentési szintek
6-1. Escape karakterek
10-1. Aritmetikai operátorok
10-2. Bitorientált operátorok
10-3. Összehasonlító operátorok
10-4. Növelő/csökkentő operátorok
10-5. Logikai operátorok
10-6. Operátorok precedenciája
14-1. PHP hiba típusok
1. XML konstansok
1. Returned Objects for imap_fetchstructure()
2. Primary body type
3. Transfer encodings
1. Mailbox properties
1. Font file format
1. Math constants
1. Naptár módok
1. Naptár hét módok
1. LONGVARBINARY handling
1. error_log() log típusok
1. error_reporting() bit értékek
1. The user information array
1. The user information array
1. Postmaster and PHP
1. Limits of Shared Memory by the Unix OS
1. Supported XML handlers
1. XML parser options
1. UTF-8 encoding
B-1. PHP Internal Types
C-1. Debugger Line Types
C-2. Debugger Error Types
Példák listája
1-1. Egy bevezető példa
3-1. UNIX include_path
3-2. Windows include_path
5-1. A PHP-módba kerülés lehetőségei
6-1. "Here doc" string példa [VAS: Vége A Stringnek de helyette lehet bármi:)]
6-2. String példák
7-1. Egyszerű form változó
7-2. Összetettebb form változók
7-3. SetCookie Példa
8-1. Konstans definiálása
8-2. A __FILE__ és a __LINE__ használata
11-1. Az include() PHP3-ban és PHP4-ben
12-1. Variable function example
15-1. GIF kép készítése PHP-vel
16-1. HTTP azonosítási példa
16-2. HTTP azonosítási példa, ami új nevet és jelszót kér
18-1. File Upload Form
18-2. Több file egyidejű feltöltése
19-1. Egy távoli weboldal címsorának megállapítása
19-2. Adat tárolása távoli gépen
1. getallheaders() példa
1. Aspell_new()
1. Aspell_check()
1. Aspell_check_raw()
1. Aspell_suggest()
1. Egyszerű ClibPDF példa
2. pdfclock példa a pdflib 2.0 csomagból
1. Szöveg kimenet
1. Szöveg kimenet
1. Save/Restore
1. Oldalvázlat hozzáadása
1. Using PHP's CURL module to fetch the PHP homepage
1. Initializing a new CURL session and fetching a webpage
1. Date() example
2. Date() and mktime() example
1. Gmdate() example
1. Gmstrftime() example
1. Mktime() example
2. Last day of next month
1. Strftime() example
1. Strtotime() example
1. Creating a dBase database file
1. Using dbase_numfields()
1. DBM example
1. Visiting every key/value pair in a DBM database
1. DBA example
2. Traversing a database
1. basename() example
1. copy() example
1. dirname() example
1. diskfreespace() example
1. Fgetcsv() example - Read and print entire contents of a CSV file
1. Reading a file line by line
1. fopen() example
1. realpath() example
1. Tempnam() example
1. touch() example
1. Evaluating a FDF document
1. Accessing the form data
1. Populating a PDF document
1. Gettext()-check
1. Fsockopen() Example
2. Using UDP connection
1. setcookie() examples
1. modifying an attribute
2. adding a completely new attribute
3. modifying Title attribute
4. modifying Title attribute
5. removing attribute
1. imap_append() example
1. imap_createmailbox() example
1. Imap_delete() Beispiel
1. imap_getmailboxes() example
1. imap_getmailboxes() example
1. imap_open() example
1. imap_mailboxmsginfo() example
1. imap_rfc822_write_address() example
1. imap_rfc822_parse_adrlist() example
1. imap_setflag_full() example
1. imap_status() example
1. imap_fetch_overview() example
1. imap_mime_header_decode() example
1. imap_mail_compose() example
1. Connect to a Informix database
1. Closing a Informix connection
1. Show all rows of the "orders" table as a html table
2. Insert some values into the "catalog" table
1. Informix affected rows
1. Retrieve Informix sqlca.sqlerrd[x] values
1. Informix fetch rows
1. Informix results as HTML table
1. Fielnames and SQL fieldtypes
1. Informix SQL fieldproperties
1. Ibase_connect() example
1. GetImageSize
2. GetImageSize returning IPTC
1. Creating a new GD image stream and outputting an image.
1. Example to handle an error during creation (courtesy vic@zymsys.com)
1. Example to handle an error during creation (courtesy vic@zymsys.com )
1. Example to handle an error during creation (courtesy vic@zymsys.com)
1. ImageTTFText
1. ImageTypes
1. read_exif_data
1. Dir() Example
1. List all files in the current directory
2. List all files in the current directory and strip out . and ..
1. LDAP search example
1. Complete example with authenticated bind
1. Complete example of password check
1. Enumerating all LDAP error messages
1. Generating and catching an error
1. Show the list of attributes held for a particular directory entry
1. List all values of the "mail" attribute for a directory entry
1. Produce a list of all organizational units of an organization
1. LDAP search
1. Sending mail.
2. Sending mail with extra headers.
1. Calculating the hash and subscribing a user
1. Defining Constants
1. die example
1. Eval() example - simple text merge
1. Get_browser() example
1. Pack() format string
1. Serialize() example
1. Unpack() format string
1. Unserialize() example
1. Creating a source highlighting URL
1. Base_convert()
1. Encrypt an input value with TripleDES in ECB mode
1. Mcrypt_get_cipher_name() Example
1. Mcrypt_create_iv() example
1. Compute the SHA1 key and print it out as hex
1. Mhash_get_hash_name() Example
1. Traversing all hashes
1. Msql_tablename() example
1. MySQL close example
1. MySQL connect example
1. MySQL create database example
1. MySQL data seek example
1. Mysql_fetch_array()
1. Mysql_fetch_field()
1. mysql fetch object
1. mysql field types
1. mysql_query()
2. mysql_query()
1. Mysql_tablename() Example
1. Naptár függvények
1. easter_date() példa
1. Easter_days() példa
1. ODBC Setoption Examples
1. OCIDefineByName
1. OCIDefineByName
1. OCILogon
1. OCINLogon
1. OCINewDescriptor
1. OCIRowCount
1. OCINumCols
1. OCIFetchStatement
1. OCIColumnSize
1. OCIServerVersion
1. Code examples
1. Using a REF CURSOR from a stored procedure
2. Using a REF CURSOR in a select statement
1. OCIColumnName
1. OCIColumnType
1. classes.inc
2. test_script.php
1. Creating a PDF document with pdflib 0.6
2. Creating a PDF document with pdflib 2.x
3. pdfclock example from pdflib 2.x distribution
1. Setting document information
1. Save and Restore
1. Translation
1. Scaling
1. Including a gif image
1. Including a PNG image
1. Including a memory image
1. Multiple show of an image
1. error_log() példák
1. getlastmod() példa
1. Getrusage példa
1. phpversion() példa
1. php_sapi_name() példa
1. Egy környezeti változó beállítása
1. A require-al és include-al behívott file-ok
1. Using Large Objects
1. Pg_cmdtuples()
1. PostgreSQL fetch array
1. Postgres fetch object
1. Postgres fetch row
1. Pspell_new()
1. Pspell_check()
1. Pspell_suggest()
1. readline()
1. Examples of valid patterns
2. Examples of invalid patterns
1. find the string of text "php"
2. find the word "web"
3. Getting the domain name out of a URL
1. Getting all phone numbers out of some text.
2. Find matching HTML tags (greedy)
1. Replacing several values
2. Using /e modifier
3. Convert HTML to text
1. Getting parts of search string
1.
2. Italicizing a word within some text
1. preg_grep() example
1. Regular Expression Examples
1. Ereg() Example
1. Ereg_replace() Example
1. Split() Example
2. Split() Example
1. Sql_regcase() Example
1. Registering a variable with track_vars enabled
2. Registering a variable with register_globals enabled
3. Counting the number of hits of a single user
4. Usage of session_set_save_handler()
1. session_name() examples
1. SWF example
1. Swf_addbuttonrecord() function example
1. Addcslashes() example
1. Chop() example
1. Chr() example
1. Chunk_split() example
1. Echo() example
1. Explode() example
1. Translation Table Example
1. Meta Tags Example
1. Implode() example
1. Ord() example
1. Using parse_str()
1. rtrim() example
1. Soundex Examples
1. Sprintf(): zero-padded integers
2. Sprintf(): formatting currency
1. strcasecmp() example
1. str_pad() example
1. Strrchr() example
1. Str_repeat() example
1. Strstr() example
1. Strtok() example
1. Strtolower() example
1. Strtoupper() example
1. Str_replace() example
1. Strtr() example
1. substr_count() example
1. Substr_replace() example
1. Ucfirst() example
1. ucwords() example
1. Array() example
1. Array_count_values() example
1. Array_diff() example
1. Array_flip() example
1. Array_intersect() example
1. Array_keys() example
1. array_merge() example
1. Array_merge_recursive() example
1. Sorting multiple arrays
2. Sorting multi-dimensional array
1. Array_pad() example
1. Array_pop() example
1. Array_push() example
1. Array_rand() example
1. Array_reverse() example
1. Array_shift() example
1. Array_slice() examples
1. Array_splice() examples
1. Array_unique() example
1. Array_unshift() example
1. Array_values() example
1. Array_walk() example
1. Arsort() example
1. Asort() example
1. Compact() example
1. Each() examples
2. Traversing $HTTP_POST_VARS with each()
1. Extract() example
1. In_array() example
1. Krsort() example
1. Ksort() example
1. list() example
1. Rsort() example
1. Shuffle() example
1. Sort() example
1. Uksort() example
1. Usort() example
1. első Rawurlencode() példa
2. második Rawurlencode() példa
1. Urldecode() példa
1. Urlencode() példa
1. Unset() példa
1. Payflow Pro example
1. Payflow Pro raw example
1. Serializing a single value
2. Using incremental packets
1. wddx_serialize_vars example
1. Show XML Element Structure
2. Map XML to HTML
3. External Entity Example
4. xmltest.xml
5. xmltest2.xml
1. YAZ()
1. Example for the default domain
1. Example for the NIS order
1. Example for the NIS master
1. Example for NIS match
1. Example for the NIS first
1. Example for NIS next
1. Small Zlib Example
1. Gzopen() Example
A-1. Migration: old start/end tags
A-2. Migration: first new start/end tags
A-3. Migration: second new start/end tags
A-4. Migration: third new start/end tags
A-5. Migration: old if..endif syntax
A-6. Migration: new if..endif syntax
A-7. Migration: old while..endwhile syntax
A-8. Migration: new while..endwhile syntax
A-9. Migration from 2.0: return values, old code
A-10. Migration from 2.0: return values, new code
A-11. Migration from 2.0: concatenation for strings
B-1. Fetching function arguments
B-2. Variable function arguments
B-3. Checking whether $foo exists in a symbol table
B-4. Finding a variable's size in a symbol table
B-5. Initializing a new array
B-6. Adding entries to a new array
B-7. Adding a new resource
B-8. Using an existing resource
B-9. Deleting an existing resource
C-1. Example Debugger Message