难倒 [英] Stumped

查看:50
本文介绍了难倒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,我遇到了一个小问题。我有一个html文件,其中有一些

<?php?>需要评估的标签等。你们中的一些人可能已经知道我在做什么了。


我需要能够打开文件,进行一些更改,然后执行

代码。我需要它的行为像include()或require()。 eval()是一个很好的解决方案,但它只支持原始的PHP代码。


所以我正在做的是将修改后的代码保存回来到临时文件,

在临时文件上调用include(),然后删除它。看起来好像很多工作。


有没有办法更好地做到这一点?基本上是一个include()我传递了
代码而不是文件指针?


-

- Thom McGrath

ZeeTox项目负责人和ZAZ的首席程序员

用iChat或AOL Instant Messenger联系我:zazTekcor

Alright, I''ve run into a little problem. I have an html file with some
<?php ?> tags and such that need to be evaluated. Some of you probably
already know what I''m getting at.

I need to be able to open the file, make some changes, then execute the
code. I need it to behave like include() or require(). eval() was a
decent solution, but it only supports raw php code.

So what I''m doing is saving the modified code back out to a temp file,
calling include() on the temp file, and then deleting it. Seems like an
awful lot of work.

Is there a way to do this better? Basically an include() that I pass
code to rather than a file pointer?

--
- Thom McGrath
Head of the ZeeTox Project and lead programmer for The ZAZ
Contact me with iChat or AOL Instant Messenger: zazTekcor

推荐答案

" Thom McGrath" <第** @ thezaz.com>在留言中写道

news:2004021319433416807%thom @ thezazcom ...
"Thom McGrath" <th**@thezaz.com> wrote in message
news:2004021319433416807%thom@thezazcom...
好吧,我遇到了一个小问题。我有一个带有一些
<?php?>的html文件需要评估的标签等。你们中的一些人可能已经知道我在做什么。

我需要能够打开文件,进行一些更改,然后执行
代码。我需要它的行为像include()或require()。 eval()是一个不错的解决方案,但它只支持原始的PHP代码。

所以我正在做的是将修改后的代码保存回临时文件,
在临时文件上调用include(),然后将其删除。看起来好像很多工作。

有没有办法做得更好?基本上是一个include(),我传递代码而不是文件指针?

-
- Thom McGrath
ZeeTox项目负责人和首席程序员ZAZ
用iChat或AOL Instant Messenger联系我:zazTekcor
Alright, I''ve run into a little problem. I have an html file with some
<?php ?> tags and such that need to be evaluated. Some of you probably
already know what I''m getting at.

I need to be able to open the file, make some changes, then execute the
code. I need it to behave like include() or require(). eval() was a
decent solution, but it only supports raw php code.

So what I''m doing is saving the modified code back out to a temp file,
calling include() on the temp file, and then deleting it. Seems like an
awful lot of work.

Is there a way to do this better? Basically an include() that I pass
code to rather than a file pointer?

--
- Thom McGrath
Head of the ZeeTox Project and lead programmer for The ZAZ
Contact me with iChat or AOL Instant Messenger: zazTekcor



好​​吧,我有点困惑,为什么要把.html文件重命名为。 php和

做一个包含?

如果这不起作用,我可能会为你找一个解决方案,但需要了解

你是一个好一点。你能举个例子吗?


或者你只是想eval()html和代码? (这是可能的)


-

Mike Bradley
http://www.gzentools.com - 免费在线php工具



Ok, I am a little confused, why nit just rename the .html file to .php and
do an include?
If that does not work, I may have a solution for you, but need to understand
you a bit better. can you give example?

or do you just want to eval() html and code? (this is possible)

--
Mike Bradley
http://www.gzentools.com -- free online php tools


2004-02-13 20 :03:54-505,CountScubula < me@scantek.hotmail.com>说:
On 2004-02-13 20:03:54 -0500, "CountScubula" <me@scantek.hotmail.com> said:
好的,我有点困惑,为什么nit只是将.html文件重命名为.php而
做一个包含?

如果这不起作用,我可能会为您提供解决方案,但需要了解您好一点。你能举个例子吗?

或者你只是想eval()html和代码? (这是可能的)
Ok, I am a little confused, why nit just rename the .html file to .php and
do an include?
If that does not work, I may have a solution for you, but need to understand
you a bit better. can you give example?

or do you just want to eval() html and code? (this is possible)




eval()html和代码。我不能做一个包含因为代码有点

动态。它混合了HTML和PHP,就像一个网页文件(因为它的价格几乎就是它的b $ b)。


-

- Thom McGrath

ZeeTox项目负责人和ZAZ的首席程序员

用iChat或AOL Instant Messenger联系我:zazTekcor



eval() html and code. I can''t do an include because the code is a bit
dynamic. It has HTML and PHP mixed in, like a web page file (as that''s
pretty much what it is).

--
- Thom McGrath
Head of the ZeeTox Project and lead programmer for The ZAZ
Contact me with iChat or AOL Instant Messenger: zazTekcor


这里有一些代码,我借了一些东西:

将用/ embeded php标签对字符串进行eval


<?php

here is some code, I borrowed some pieces:
is will do the eval on a string with/embeded php tags

<?php


这篇关于难倒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆