第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

如何使用按鈕回顯php中的函數(shù)?

如何使用按鈕回顯php中的函數(shù)?

PHP
慕村225694 2021-07-14 17:02:09
我正在制作一個(gè)事件日歷。我想使用按鈕在 php 中回顯一個(gè)函數(shù)。我的實(shí)際代碼:日歷.php<?php include_once('functions.php'); ?> <?php echo getCalender(); ?>函數(shù).php<?phpif(isset($_POST['func']) && !empty($_POST['func'])){    switch($_POST['func']){        case 'getCalender':            getCalender($_POST['year'],$_POST['month']);            break;        case 'getEvents':            getEvents($_POST['date']);            break;        default:            break;    }}//Get calendar full HTMLfunction getCalender($year = '',$month = ''){    $dateYear = ($year != '')?$year:date("Y");    $dateMonth = ($month != '')?$month:date("m");    $date = $dateYear.'-'.$dateMonth.'-01';    $currentMonthFirstDay = date("N",strtotime($date));    $totalDaysOfMonth = cal_days_in_month(CAL_GREGORIAN,$dateMonth,$dateYear);    $totalDaysOfMonthDisplay = ($currentMonthFirstDay == 7)?($totalDaysOfMonth):($totalDaysOfMonth + $currentMonthFirstDay);    $boxDisplay = ($totalDaysOfMonthDisplay <= 35)?35:42;?>    <div id="calender_section">    //} <script type="text/javascript">    function getCalendar(target_div,year,month){        $.ajax({            type:'POST',            url:'functions.php',            data:'func=getCalender&year='+year+'&month='+month,            success:function(html){                $('#'+target_div).html(html);            }        });    }function getEvents(date){        $.ajax({            type:'POST',            url:'functions.php',            data:'func=getEvents&date='+date,            success:function(html){                $('#event_list').html(html);                $('#event_add').slideUp('slow');                $('#event_list').slideDown('slow');            }        });    }現(xiàn)在我想使用按鈕來調(diào)用 getcalendar 函數(shù)。我試過這個(gè):日歷.php <form class="" action="" method="post">               <input type="button" value="Dhaka" onclick="<?php echo getCalender(); ?>"/>              </form>現(xiàn)在這不是等待按鈕點(diǎn)擊。當(dāng)我刷新頁(yè)面時(shí),即使我沒有單擊按鈕,它也會(huì)顯示日歷。我該如何解決這個(gè)問題?
查看完整描述

2 回答

?
米脂

TA貢獻(xiàn)1836條經(jīng)驗(yàn) 獲得超3個(gè)贊

這是functions.php的代碼。你提到了 getCalender 而不是 getCalendar


<?php include_once('functions.php'); ?>

<form class="" action="" method="post">

<input type="button" value="Dhaka" onclick="getCalendar()"/>

</form>

另外,關(guān)閉functions.php 文件中g(shù)etEvents 函數(shù)之后的腳本標(biāo)記。


查看完整回答
反對(duì) 回復(fù) 2021-07-16
?
至尊寶的傳說

TA貢獻(xiàn)1789條經(jīng)驗(yàn) 獲得超10個(gè)贊

您可以使用

print_f(Object);

然后試試你的代碼,而不是 echo;


查看完整回答
反對(duì) 回復(fù) 2021-07-16
  • 2 回答
  • 0 關(guān)注
  • 210 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)