Re: Generating a php file
| From: | Dan Rossi | Date: | Wed, 11 May 2005 21:22:23 +0000 |
| Subject: | Re: Generating a php file | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-214981@lists.php.net to get a copy of this message | ||
On 12/05/2005, at 6:03 AM, Rory Browne wrote:
You can start by clarifying. I had to read your message three times before I got a vague understanding. What I'm hearing is that you want to put something like <?php $msg = get_message(); ?> into a string? You are having difficulty doing this because you are finding that your string contains the value of $msg, instead of a doller sign, followed by 'msg'? If so, then you can: Use Single Quotes: $code = '<?php $msg = get_message(); ?>' or Escape your $-signs, by placing a backslash(\) in front of the $-sign $code = "<?php \$msg = get_message(); ?>";I've had a habit of this of late ! Let me clarify for you then ;) I have a php file say <? $query = $_SERVER['QUERY_STRING']; $somevar = 'somevalue'; ?> i need to dynamically generate some values in the script and output a new file to download from it ie <? $query = $_SERVER['QUERY_STRING']; $somevar = $this->somevalue; ?> becomes <? $query = $_SERVER['QUERY_STRING']; $somevar = 'somevalue'; ?> where $this->somevalue is from my generator class ;) However if I do $buffer = "<? $query = $_SERVER['QUERY_STRING']; $somevar = 'somevalue'; ?>"; I get all sorts of errors around $_SERVER.