absolute Pfad-Angabe per PHP

Braucht man manchmal.

Ist auch ganz simpel:

<?php
echo "Der absolute Pfad lautet: ";
$path = preg_replace("/\\\\/", "/", __FILE);
$path = dirname ($path);
$path = trim($path);
echo "<strong>{$path}</strong>";
?>

3 thoughts on “absolute Pfad-Angabe per PHP

  1. ereg_replace is aber deprecated. man sollte stattdessen preg_replace verwenden ^^”

    also dann preg_replace(“/\\\\/”, “/”, __FILE);

Hinterlasse eine Antwort

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind markiert *

*

Du kannst folgende HTML-Tags benutzen: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

For spam filtering purposes, please copy the number 8470 to the field below: