<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>ykng0</author_name>
  <author_url>https://blog.hatena.ne.jp/ykng0/</author_url>
  <blog_title>8t's BBR</blog_title>
  <blog_url>https://ykng0.hatenablog.com/</blog_url>
  <categories>
    <anon>web系</anon>
  </categories>
  <description>phpでファイルパスを定数として定義しておく場合、例えば、 const JSON_PATH = &quot;./sample.json&quot;;とやりがちだったが、このやり方だと不具合を起こす場合がある。この書き方をしたphpだけを実行する場合は問題なく動作するが、execなどで呼び出される際はディレクトリが違う場合うまく動作しない。 phpでは基本的に絶対パスで記述しておけば余計な不具合に頭を悩ませないで済むっぽいが、いくつもphpファイルがある場合、管理が面倒くさい。この時に便利なのが__DIR__とかいうマジカル定数で、その記述があるファイルのディレクトリを表してくれるものだが、 const JSON_…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fykng0.hatenablog.com%2Fentry%2F2016%2F12%2F03%2F134900&quot; title=&quot;phpでのファイルパスの定数宣言について - 8t&amp;#39;s BBR&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2016-12-03 13:49:00</published>
  <title>phpでのファイルパスの定数宣言について</title>
  <type>rich</type>
  <url>https://ykng0.hatenablog.com/entry/2016/12/03/134900</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
