Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

read file & show a part of it

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

read file & show a part of it

Postby johnmayer860 » Sun Oct 07, 2012 6:20 am

hi to all
i have a question.
i have many files (page.php , index.php , module.php , ...) and at the top of them i wrote that file information.
for example :
/*
fileName : page
Description : description of file
Version : 1.0
*/

i want to read this part of file and store in variables ($name = page,$desc = description of file, $ver = 1.0) and use these vars in my codes.
this is like wordpress theme information that get that info s from style.css file.
now, how i can read these lines? what shall i do?
pls help me, thanks :help:
johnmayer860
New php-forum User
New php-forum User
 
Posts: 3
Joined: Sun Oct 07, 2012 5:51 am

Re: read file & show a part of it

Postby us2rn4m2 » Mon Oct 08, 2012 9:02 am

Hi,

Code: Select all
/**
* fileName : page
* Description : description of file
* Version : 1.0
*/
   class Example {}

   $rc = new ReflectionClass('Example');
   var_dump($rc->getDocComment());


Result:
/**

* fileName : page

* Description : description of file

* Version : 1.0

*/

http://www.php.net/manual/en/book.reflection.php
us2rn4m2
New php-forum User
New php-forum User
 
Posts: 17
Joined: Thu Aug 09, 2012 1:28 pm


Return to PHP coding => General

Who is online

Users browsing this forum: WebOutGateway and 3 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.