PHP : fonction pour gerer les conversions de dates
Exemples d’utilisation : echo GLOBAL_dateFormatter(« 21/07/2022 09:51:33 », « d/m/Y H:i:s », « Y-m-d H:i:s », « Europe/Luxembourg », « UTC »);
Exemples d’utilisation : echo GLOBAL_dateFormatter(« 21/07/2022 09:51:33 », « d/m/Y H:i:s », « Y-m-d H:i:s », « Europe/Luxembourg », « UTC »);
// 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 /
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);
Mettez cette fonction en début de code et cela devrait vous protéger un minimum
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… Lire la suite »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.))
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… Lire la suite »PHP : WINDOWS Call to undefined function ldap_connect()
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)… Lire la suite »PHP : Fonction pour CURL (avec authentification Bearer si besoin)
function deleteOldFile( $filename) { // in seconde ici 600 secondes soit 10 minute if (time()-filemtime($filename) > 600) { unlink($filename); } }