Skip to content

Instantly share code, notes, and snippets.

@yasuken1990
Created March 12, 2014 03:26
Show Gist options
  • Save yasuken1990/9500257 to your computer and use it in GitHub Desktop.
Save yasuken1990/9500257 to your computer and use it in GitHub Desktop.
driname(), getcwd() 関数の違い。
<?php
// homeディレクトリで行ってください
echo '1. __FILE__' . PHP_EOL;
echo '2. dirname(__FILE__)' . PHP_EOL;
echo '3. getcwd()' . PHP_EOL;
echo '4. chdir(\'.ssh/\')' . PHP_EOL;
echo '5. __FILE__' . PHP_EOL;
echo '6. dirname(__FILE__)' . PHP_EOL;
echo '7. getcwd()' . PHP_EOL;
echo PHP_EOL;
echo '1. ' . __FILE__ . PHP_EOL;
echo '2. ' . dirname(__FILE__) . PHP_EOL;
echo '3. ' . getcwd() . PHP_EOL;
//exec('ls -l', $fileAll);
//print_r($fileAll);
chdir('.ssh/');
echo '4. ' . '** chdir(\'.ssh/\') を実行し、ワークングディレクトリが.ssh/ に変わる **' . PHP_EOL;
//exec('ls -l', $fileAll);
//print_r($fileAll);
echo '5. ' . __FILE__ . PHP_EOL;
echo '6. ' . dirname(__FILE__) . PHP_EOL;
echo '7. ' . getcwd() . PHP_EOL;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment