佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 892|回复: 10

请教PHP问题!

[复制链接]
发表于 1-4-2008 09:48 AM | 显示全部楼层 |阅读模式
PHP 和 MYSQL 的 STATEMENT 能存在资料库里然后 call 出来用吗?

小弟我 CALL STATEMENT 出来却不能执行,像似不确认 PHP BLOCK这样的,  PHP BLOCK 里的 STATEMENT 直接像内容一样 DISPLAY 出来。

请指点我~谢~

[ 本帖最后由 conmen80 于 1-4-2008 09:55 AM 编辑 ]
回复

使用道具 举报


ADVERTISEMENT

发表于 1-4-2008 09:55 AM | 显示全部楼层
那么就要看你储存的对吗??
call 出来的时候又对吗??
回复

使用道具 举报

 楼主| 发表于 1-4-2008 10:55 AM | 显示全部楼层

回复 2# lawty 的帖子

我是直接将 <?PHP ...statement... ?>储存在table field 里...
哪要如何从资料库call出来?

请指点小弟~
回复

使用道具 举报

发表于 2-4-2008 06:33 AM | 显示全部楼层
看不到你整体要的东西。。。
可以把你的code方上来看看吗??
大家一起研究。。。
回复

使用道具 举报

发表于 2-4-2008 10:48 AM | 显示全部楼层
MySQL应该可以啦,你直接store整个INSERT INTO.....的command,然后再从Database Query出来,mysql_query()它。

至于PHP,你是不是想store象某个function,如substr等等,或是你自己的function,然后query出来执行它?嗯。。。这个就没什么Idea了。。。

PHP好像没有remote procedure call 的。。。。
回复

使用道具 举报

 楼主| 发表于 2-4-2008 03:35 PM | 显示全部楼层
原帖由 yhchan 于 2-4-2008 10:48 AM 发表

至于PHP,你是不是想store象某个function,如substr等等,或是你自己的function,然后query出来执行 ...



对~就是像你说的,像store一个php statement mixed with html code, 然后在front-end call/execute出来。。。
我试过test它将 <?php echo "test"; ?> 存在资料库然后browser call出来,当执行到 <?php ... ?> block 时, 就没东西了!
还有什么方法吗?请指点。。。谢!
回复

使用道具 举报

Follow Us
发表于 3-4-2008 10:58 AM | 显示全部楼层
你试试看。。。
把那些< ' " 这些全部换去word 然后store.
call的时候再把那些word变回< ' "...
明白吗??
回复

使用道具 举报

 楼主| 发表于 3-4-2008 12:00 PM | 显示全部楼层
原帖由 华少 于 3-4-2008 10:58 AM 发表
你试试看。。。
把那些< ' " 这些全部换去word 然后store.
call的时候再把那些word变回< ' "...
明白吗??



你word意思是这样吗?   

& lt;       & gt;

试过了, 不行...



[ 本帖最后由 conmen80 于 3-4-2008 12:02 PM 编辑 ]
回复

使用道具 举报


ADVERTISEMENT

发表于 3-4-2008 12:28 PM | 显示全部楼层
刚发现这个,看看适合你用吗。。。

<?php

$phpcode = '
<?php
$test = "abc";
$test2 = substr($test, 1);
echo "<a href=\"123.php\">" . $test2 . "</a>";
?>';


$descriptorspec = array(
   0 => array("pipe", "r"),  // stdin is a pipe that the child will read from
   1 => array("pipe", "w")  // stdout is a pipe that the child will write to
);

$process = proc_open('php', $descriptorspec, $pipes);

if (is_resource($process)) {
    // $pipes now looks like this:
    // 0 => writeable handle connected to child stdin
    // 1 => readable handle connected to child stdout
    // Any error output will be appended to /tmp/error-output.txt

    fwrite($pipes[0], $phpcode);
    fclose($pipes[0]);

    echo stream_get_contents($pipes[1]);
    fclose($pipes[1]);
   
    $return_value = proc_close($process);
}

?>

将你的php + html code,assign 进$phpcode,可以execute出来。
详细的detail我也不清楚,我在php manual 的Program Execution Functions 里看到的,"proc_open" 那part。
回复

使用道具 举报

 楼主| 发表于 3-4-2008 12:51 PM | 显示全部楼层
先试试,谢过你了!
回复

使用道具 举报

发表于 3-4-2008 02:36 PM | 显示全部楼层
<?php

session_start();
session_destroy();

require("config.php");

header("Location:".$config_basedir);
?>
这句是我看书taip的, 想问下session_start();
session_destroy();是什么意识?
require("config.php");这句的require是做么的。config.php是不是一个file来得。
header("Location:".$config_basedir);这句有时???

书上写是log out 的code来得,可是有error...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 30-12-2025 01:16 PM , Processed in 0.130316 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表