Jump to content

can you generate a file and include php within it?


DamienRoche

Recommended Posts

Not sure how to approach this.

 

I want to be able to generate a php file. Can I simply include the php I want to include in the file, in a string/array?

 

Are there any pitfalls to this?

 

Thanks.

Ok, well if I say put this code into a string:

 

<?php

$var = "value";

?>

<html>

<?php include('head.php');?>

<?php include('body.php');?>

<?php include('foot.php');?>


</html>

 

example:

 


$string = "<?php

$var = \"value\";

?>

<html>

<?php include('head.php');?>

<?php include('body.php');?>

<?php include('foot.php');?>


</html>";

#generate file here and save string into it.

 

...will it parse that if I put it into a php file?- or generate one with it? Maybe so, not had chance to test. My main concern is if anybody knows of any pitfalls with this.

 

Will the code be parsed as php, simple as...or is there some other element that comes into play that may compromise it?

 

Thanks.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.