• 8

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 187


File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 187
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

file_put_contents path question

I want to create html page using php code form c:\www\test\script\new\creat_html.php to c:\www\test\html\index.html.

Now in c:\www\test\script\new\creat_html.php how do I set the path?

I use dirname(__FILE__), but it just gets the parent path. How to? Thanks.

file_put_contents( dirname(__FILE__) . '/index.html', $html);

dirname(__FILE__) will return:
you need c:\www\test\html\index.html
so you need to up to 2 levels, you can do it with .. symbol in path:
c:\www\test\script\new\..\..\ = c:\www\test\
now you can add necessary part of path:

  • 9
Reply Report
file_put_contents("../../index.html", $html);

easy - simple

EDIT: You have to access creat_html.php directly, or this solution won't work !

  • 6
Reply Report