// 2018-08-03T15:21:28+00:00$date = date_create_from_format(‘Y-m-d\TH:i:sT‘, ‘ 2018-08-03T15:21:28+00:00 ‘);echo date_format($date, ‘Y-m-d H:i:s‘); Le format mysql est bien Y-m-d H:i:s pour le type datetime /
Catégorie : PHP

PHP : Convertir un chaine (string) possédant des sauts de lignes en tableau (array)PHP : Convertir un chaine (string) possédant des sauts de lignes en tableau (array)
1er méthode si vous connaissez le caractére de séparation 2ème méthode si vous connaissez pas le caractére de séparation preg_match_all("/[\S ]+/", $monString, $match)print_r($match);

PHP FAILLE XSS ASTUCEPHP FAILLE XSS ASTUCE
Mettez cette fonction en début de code et cela devrait vous protéger un minimum // FILTERING VALUES FROM USER, PREVENTING XSS INJECTIONS if(!empty($_POST)) { function filter_xss(&$value) { if(is_array($value)) { array_walk_recursive($value,
PHP : Date -30 jours ou -X joursPHP : Date -30 jours ou -X jours
Je me le mets en mémo car je l’oublie à chaque fois je ne sais pas pk : echo date('Y-m-d',strtotime('- 30 day')) Et avec l’objet date : $dateDeb = new
PHP : fonction pour déterminer si un jour est un WEEKENDPHP : fonction pour déterminer si un jour est un WEEKEND
//Date in YYYY-MM-DD format.$dateToSet = '2020-02-08';//Output for testing purposes.if(isWeekend($dateToSet)){echo $dateToSet . ' it's a weekend.';} else{echo $dateToSet . ' it's on a weekday.';}function isWeekend($date){//Set this to FALSE until proven otherwise.$weekendDay
PHP : PHP Warning: PHP Startup: Unable to load dynamic library ‘oci8_12c’ (tried: D:/project/php/ext/oci8_12c (The specified module could not be found.), D:/php/ext/php_oci8_12c.dll (%1 is not a valid Win32 application.))PHP : PHP Warning: PHP Startup: Unable to load dynamic library ‘oci8_12c’ (tried: D:/project/php/ext/oci8_12c (The specified module could not be found.), D:/php/ext/php_oci8_12c.dll (%1 is not a valid Win32 application.))
PHP Warning: PHP Startup: Unable to load dynamic library ‘oci8_12c’ (tried: D:/project/php/ext/oci8_12c (The specified module could not be found.), D:/project/php/ext/php_oci8_12c.dll (%1 is not a valid Win32 application.)) Vérifier que vous

PHP : WINDOWS Call to undefined function ldap_connect()PHP : WINDOWS Call to undefined function ldap_connect()
Bien vérifier la configuration de votre php.ini avec « extension=ldap » bien décommenté et la présence de la dll « php_ldap.dll » dans le répertoire ext PHP. Ensuite veiller à ce que PHP soit

PHP : Crypt and DecrypPHP : Crypt and Decryp
//CRYPT and DECRYPT function bobbyCrypt( $string, $action = 'e' ,$secret_key ) { $secret_iv = 'bibliogeek'; $output = false; $encrypt_method = "AES-256-CBC"; $key = hash( 'sha256', $secret_key ); $iv = substr(
PHP : String RandomPHP : String Random
//RANDOM STRING function getStringRandom($size) { // Initialisation des caractères utilisables $characters = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, "a", "b",

PHP : Fonction pour CURL (avec authentification Bearer si besoin)PHP : Fonction pour CURL (avec authentification Bearer si besoin)
Curl php avec authentification Bearer au besoin function callAPI($method, $url, $data ,$sessionIdToPut ){ $curl = curl_init(); switch ($method){ case "POST": curl_setopt($curl, CURLOPT_POST, 1); if ($data) curl_setopt($curl, CURLOPT_POSTFIELDS, $data); break; case