dourang8305 2014-01-21 02:56
浏览 85

如何从php函数中调用php文件

I have a php function that I call from javascript through ajax. In that php function, I want to call a php file. Is this possible? The php file that I would like to call has html.

The php file to call looks like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Calendar DB</title>
</head>

<body>

<div id="debug" title="Calendar Update" style="background:white; width:640px; height:580px; color:#404040; overflow:hidden; border: 4px solid #404040; margin:0 auto;">
<div>Liturgical Calendar Generation</div>

<?php

ini_set('display_errors', 0);
error_reporting(E_ALL);

function get_year() {
    $year = date("Y");
    return $year;
}

create_liturgical_calendar($year);

function create_liturgical_calendar($year) {

}

mysql_close($con);

?> 
</div>
</div> 

</body>
</html>

The php where the file should be called looks like this:

global $dbco;
global $db_liturgical;
mysql_select_db($db_liturgical, $dbco);

$qliturt = "SELECT * FROM calendar WHERE year ='$year'";
$rliturt = mysql_query($qliturt);
$num_rows = mysql_num_rows($rliturt);
if ( $num_rows < 350 ) {
/* call php file */
}

Can the php file be called where shown?

  • 写回答

2条回答 默认 最新

  • duanpo8329 2014-01-21 03:00
    关注

    You can use include 'filename.php' or you can use require

    评论

报告相同问题?

悬赏问题

  • ¥200 关于#c++#的问题,请各位专家解答!
  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥15 绘制多分类任务的roc曲线时只画出了一类的roc,其它的auc显示为nan
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀