informatique:php:tips
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
informatique:php:tips [25/01/2011 14:16] – [Manipulation fichier Excel] cyrille | informatique:php:tips [25/02/2021 20:08] (Version actuelle) – [Php side] cyrille | ||
---|---|---|---|
Ligne 29: | Ligne 29: | ||
=====Sécurité===== | =====Sécurité===== | ||
- | [[http:// | + | [[http:// |
Ligne 44: | Ligne 44: | ||
==== RegEx ==== | ==== RegEx ==== | ||
- | Validation | + | === syntaxe adresse email === |
<code php> | <code php> | ||
Ligne 58: | Ligne 58: | ||
</ | </ | ||
+ | Voir aussi [[http:// | ||
+ | |||
+ | === Collation caractères unicode === | ||
+ | |||
+ | Pour prendre les caractères accentués ou autres de la langue française: é, è, ê, ù, ç, É, À, ... Utiliser la classe de caractères '' | ||
+ | |||
+ | < | ||
+ | // match les caractères français et espace et tiret: | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | Pour comparer des mots avec caractères accentués (diacritics) sans tenir compte des accents: | ||
+ | <code php>$s1 = 'en été ça va là' ; | ||
+ | $s2 = 'en ÉTE Ça va Là' ; | ||
+ | $s1 = strtolower( iconv( ' | ||
+ | $s2 = strtolower( iconv( ' | ||
+ | echo ' | ||
====Cross Platform ==== | ====Cross Platform ==== | ||
Ligne 92: | Ligne 109: | ||
==== Manipulation fichier Excel ==== | ==== Manipulation fichier Excel ==== | ||
- | [[http:// | + | * [[https:// |
+ | * [[http:// | ||
Le package Spreadsheet_Excel_Writer | Le package Spreadsheet_Excel_Writer | ||
Ligne 103: | Ligne 121: | ||
[[http:// | [[http:// | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | ==== Network ==== | ||
+ | |||
+ | === Wake On Lan (WOL) === | ||
+ | |||
+ | <code php> | ||
+ | # Wake on LAN - (c) HotKey@spr.at, | ||
+ | # Modified by Allan Barizo http:// | ||
+ | flush(); | ||
+ | function WakeOnLan($addr, | ||
+ | $addr_byte = explode(':', | ||
+ | $hw_addr = ''; | ||
+ | for ($a=0; $a <6; $a++) $hw_addr .= chr(hexdec($addr_byte[$a])); | ||
+ | $msg = chr(255).chr(255).chr(255).chr(255).chr(255).chr(255); | ||
+ | for ($a = 1; $a <= 16; $a++) $msg .= $hw_addr; | ||
+ | // send it to the broadcast address using UDP | ||
+ | // SQL_BROADCAST option isn't help!! | ||
+ | $s = socket_create(AF_INET, | ||
+ | if ($s == false) { | ||
+ | echo "Error creating socket!\n"; | ||
+ | echo "Error code is '" | ||
+ | return FALSE; | ||
+ | } | ||
+ | else { | ||
+ | // setting a broadcast option to socket: | ||
+ | $opt_ret = socket_set_option($s, | ||
+ | if($opt_ret <0) { | ||
+ | echo " | ||
+ | return FALSE; | ||
+ | } | ||
+ | if(socket_sendto($s, | ||
+ | echo "Magic Packet sent successfully!"; | ||
+ | socket_close($s); | ||
+ | return TRUE; | ||
+ | } | ||
+ | else { | ||
+ | echo "Magic packet failed!"; | ||
+ | return FALSE; | ||
+ | } | ||
+ | | ||
+ | } | ||
+ | } | ||
+ | // Port number where the computer is listening. Usually, any number between 1-50000 will do. Normally people choose 7 or 9. | ||
+ | $socket_number = " | ||
+ | // MAC Address of the listening computer' | ||
+ | $mac_addy = " | ||
+ | // IP address of the listening computer. Input the domain name if you are using a hostname (like when under Dynamic DNS/IP) | ||
+ | $ip_addy = gethostbyname(" | ||
+ | | ||
+ | WakeOnLan($ip_addy, | ||
+ | |||
+ | </ | ||
+ | |||
+ | === Import gros fichier === | ||
+ | |||
+ | Upload large file. | ||
+ | |||
+ | == Php side == | ||
+ | |||
+ | * memory_limit | ||
+ | * upload_max_filesize | ||
+ | * post_max_size | ||
+ | |||
+ | To use with Laravel and JS libraries look at [[https:// | ||
+ | == Nginx side == | ||
+ | |||
+ | |||
+ | == Client side (chunking) == | ||
+ | |||
+ | * javascript | ||
+ | * https:// | ||
+ | * https:// | ||
+ | |||
+ | Cross-site chunked uploads: by default, browsers don't allow all headers used for cross-site file uploads, if they are not explicitly defined as allowed with the following server-side headers: | ||
+ | < | ||
+ | Access-Control-Allow-Headers Content-Type, | ||
+ | </ | ||
informatique/php/tips.1295961384.txt.gz · Dernière modification : 19/05/2012 00:15 (modification externe)