dex.php file, NOT your controller or view files.
CodeIgniter uses a front controller so paths are always relative to the main site index.</p>

<p>If your server is running an open_basedir restriction this function
might not work if you are trying to access a file above the calling script.</p>

<h2>write_file('<var>path</var>', <kbd>$data</kbd>)</h2>

<p>Writes data to the file specified in the path.  If the file does not exist the function will create it. Example:</p>

<code>
$data = 'Some file data';<br />