diff --git a/_date.php b/_date.php new file mode 100644 index 0000000..771b280 --- /dev/null +++ b/_date.php @@ -0,0 +1,31 @@ +format($date); +// samedi 10 octobre 2020 à 08:00 ; Asia/Singapore +// samedi 10 octobre 2020 à 02:00 ; Europe/Paris + + +$locale = "fr_FR.UTF-8"; +$formatter = new IntlDateFormatter($locale, IntlDateFormatter::LONG, IntlDateFormatter::NONE, "Europe/Paris"); +$date = new DateTime("2020-10-10 00:00 UTC"); +echo $formatter->format($date); +// 10 octobre 2020 ; Europe/Paris +// 10 octobre 2020 ; Asia/Singapore +?> \ No newline at end of file diff --git a/_paths.php b/_paths.php new file mode 100644 index 0000000..8bd8562 --- /dev/null +++ b/_paths.php @@ -0,0 +1,146 @@ +"; +echo '' . debug_backtrace()[0]['file'] . ' ' . debug_backtrace()[0]['line'] . ''; +echo ""; +echo '
';
+if(is_array($d)) {
+ print_r($d);
+ } else if(is_object($d)) {
+ var_dump($d);
+ }
+echo '';
+}
+?>
+
+
+
+
+
+
+
+
+
+pathinfo(__FILE__)' . PHP_EOL;
+echo 'Retourne des informations sur un chemin système' . PHP_EOL; +_pr(pathinfo(__FILE__)); + +// https://www.php.net/manual/fr/function.realpath.php +// Retourne le chemin canonique absolu +// realpath() + +echo '
Retourne le chemin canonique absolu' . PHP_EOL; +echo '
' . realpath('.') . '' . PHP_EOL;
+
+// https://www.php.net/manual/fr/function.parse-url.php
+// Analyse une URL et retourne ses composants
+// parse_url()
+
+
+echo 'Le chemin complet et le nom du fichier courant avec les liens symboliques résolus' . PHP_EOL; +echo '
' . __FILE__ . '' . PHP_EOL; // /Users/bruno/Sites/sls/paths.php + +echo '
Le dossier du fichier' . PHP_EOL; +echo '
' . __DIR__ . '' . PHP_EOL; // /Users/bruno/Sites/sls + +echo '
Renvoie le chemin du dossier parent' . PHP_EOL; +echo '
' . dirname(__FILE__) . '' . PHP_EOL; // /Users/bruno/Sites/sls + +echo '
Retourne le dossier de travail courant' . PHP_EOL; +echo '
' . getcwd() . '' . PHP_EOL; // /Users/bruno/Sites/sls + +// https://www.php.net/manual/en/features.file-upload.post-method.php +echo '
La racine sous laquelle le script courant est exécuté, comme défini dans la configuration du serveur' . PHP_EOL; +echo '
' . $_SERVER["DOCUMENT_ROOT"] . '' . PHP_EOL; // /Users/bruno/Sites/sls + +echo '
Le chemin absolu vers le fichier contenant le script en cours d\'exécution' . PHP_EOL; +echo '
' . $_SERVER["SCRIPT_FILENAME"] . '' . PHP_EOL; // /Users/bruno/Sites/sls/paths.php + +echo '
Contient le nom du script courant. Cela sert lorsque les pages doivent s\'appeler elles-mêmes. La constante __FILE__ contient le chemin complet ainsi que le nom du fichier (i.e. inclut) courant' . PHP_EOL; +echo '
' . $_SERVER["SCRIPT_NAME"] . '' . PHP_EOL; // /paths.php + +echo '
Le nom du fichier du script en cours d\'exécution, par rapport à la racine web' . PHP_EOL; +echo '
' . $_SERVER["PHP_SELF"] . '' . PHP_EOL; // /paths.php + +echo '
Renvoie le chemin du dossier parent' . PHP_EOL; +echo '
' . $_SERVER["PATH"] . '' . PHP_EOL; // /opt/homebrew/bin:/opt/homebrew/sbin:/usr/bin:/bin:/usr/sbin:/sbin +?> + + + + \ No newline at end of file