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

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

如何從 fullCalendar 的數(shù)據(jù)庫(kù)中獲取可拖動(dòng)事件區(qū)域?

如何從 fullCalendar 的數(shù)據(jù)庫(kù)中獲取可拖動(dòng)事件區(qū)域?

收到一只叮咚 2024-01-03 15:12:50
我一直致力于使用資源列開(kāi)發(fā) fullCalendar 拖放事件?,F(xiàn)在,我已經(jīng)對(duì)可拖動(dòng)事件區(qū)域進(jìn)行了硬編碼;現(xiàn)在嘗試從數(shù)據(jù)庫(kù)中獲取它。該數(shù)據(jù)庫(kù)以前有兩個(gè)表 - 資源和事件。事件被刪除到日歷后,會(huì)在事件表中更新。資源列是從數(shù)據(jù)庫(kù)中獲取的,為了添加新資源,我構(gòu)建了一個(gè)房間按鈕,它將新資源保存在資源表中。到目前為止,我的主文件中只有五個(gè)可拖動(dòng)事件,但現(xiàn)在我也正在努力從數(shù)據(jù)庫(kù)中獲取這些事件。因此,我在數(shù)據(jù)庫(kù)中又創(chuàng)建了一個(gè)名為draggableevents 的表。該表包含兩列 id 和 EventName。這是代碼:拖拽事件.php<?phprequire "connection.php";$conn = DB::databaseConnection();$conn->beginTransaction();$sql = "Select * FROM DraggableEvents";$stmt = $conn->prepare($sql);if ($stmt->execute()) {while($result = $stmt->fetch(PDO::FETCH_ASSOC));return $result;} else {return null;}?>表單.php<head><link href='https://unpkg.com/@fullcalendar/core@4.4.0/main.min.css' rel='stylesheet' /><link href='https://unpkg.com/@fullcalendar/daygrid@4.4.0/main.min.css' rel='stylesheet' /><link href='https://unpkg.com/@fullcalendar/timegrid@4.4.0/main.min.css' rel='stylesheet' /><script src='https://unpkg.com/@fullcalendar/core@4.4.0/main.min.js'></script><script src='https://unpkg.com/@fullcalendar/interaction@4.4.0/main.min.js'></script><script src='https://unpkg.com/@fullcalendar/daygrid@4.4.0/main.min.js'></script><script src='https://unpkg.com/@fullcalendar/timegrid@4.4.0/main.min.js'></script><script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script><link href='https://unpkg.com/@fullcalendar/timeline@4.4.0/main.min.css' rel='stylesheet' /><link href='https://unpkg.com/@fullcalendar/resource-timeline@4.4.0/main.min.css' rel='stylesheet' /> <script src='https://unpkg.com/@fullcalendar/timeline@4.4.0/main.min.js'></script> <script src='https://unpkg.com/@fullcalendar/resource-common@4.4.0/main.min.js'></script> <script src='https://unpkg.com/@fullcalendar/resource-timeline@4.4.0/main.min.js'></script> <link rel="stylesheet" href="css/main.css" media="all"> <link href="main.css" rel="stylesheet"> <script src='main.js'></script></head>上面的代碼會(huì)產(chǎn)生一個(gè)空白的可拖動(dòng)事件區(qū)域。刷新頁(yè)面時(shí),draggableevents.php 文件似乎沒(méi)有加載。我在網(wǎng)絡(luò)面板中沒(méi)有看到它,因此沒(méi)有與之相關(guān)的錯(cuò)誤。
查看完整描述

1 回答

?
皈依舞

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

有一些明顯的邏輯問(wèn)題,但與 fullCalendar 沒(méi)有太大關(guān)系:

1)我在之前的問(wèn)題中多次提到過(guò)這一點(diǎn):return當(dāng)您不在函數(shù)內(nèi)部時(shí)不返回值。您認(rèn)為您到底要把它返回到哪里?require沒(méi)有辦法

2)即使有效,您也永遠(yuǎn)不會(huì)返回任何事件,因?yàn)槟?code>while循環(huán)已關(guān)閉并且不執(zhí)行任何操作。

3)$result無(wú)論如何都會(huì)超出 while 循環(huán)之外的范圍。

4)你從不執(zhí)行你的查詢(xún)

5) 你沒(méi)有知道echo活動(dòng)名稱(chēng)。

您需要將所有數(shù)據(jù)庫(kù)結(jié)果放入一個(gè)數(shù)組中,然后循環(huán)該數(shù)組以生成與fc-event數(shù)組中的條目一樣多的 div。

這是一種方法 - 我將draggableevents.php 的功能放入一個(gè)函數(shù)中,您可以在需要時(shí)調(diào)用它。

拖拽事件.php

<?php

require "connection.php";


function getDraggableEvents() {

  $conn = DB::databaseConnection();

  $sql = "Select * FROM DraggableEvents";

  $stmt = $conn->prepare($sql);

  $stmt->execute();

  $results = array();

  while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {

   $results[] = $row;

  }

  return $results;

}

?>

表單.php


<html>

<head>

  <link href='https://unpkg.com/@fullcalendar/core@4.4.0/main.min.css' rel='stylesheet' />

  <link href='https://unpkg.com/@fullcalendar/daygrid@4.4.0/main.min.css' rel='stylesheet' />

  <link href='https://unpkg.com/@fullcalendar/timegrid@4.4.0/main.min.css' rel='stylesheet' />

  <script src='https://unpkg.com/@fullcalendar/core@4.4.0/main.min.js'></script>

  <script src='https://unpkg.com/@fullcalendar/interaction@4.4.0/main.min.js'></script>

  <script src='https://unpkg.com/@fullcalendar/daygrid@4.4.0/main.min.js'></script>

  <script src='https://unpkg.com/@fullcalendar/timegrid@4.4.0/main.min.js'></script>

  <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>

  <link href='https://unpkg.com/@fullcalendar/timeline@4.4.0/main.min.css' rel='stylesheet' />

  <link href='https://unpkg.com/@fullcalendar/resource-timeline@4.4.0/main.min.css' rel='stylesheet' />

  <script src='https://unpkg.com/@fullcalendar/timeline@4.4.0/main.min.js'></script>

  <script src='https://unpkg.com/@fullcalendar/resource-common@4.4.0/main.min.js'></script>

  <script src='https://unpkg.com/@fullcalendar/resource-timeline@4.4.0/main.min.js'></script>

  <link rel="stylesheet" href="css/main.css" media="all">

  <link href="main.css" rel="stylesheet">

  <script src='main.js'></script>

</head>

<body>

  <div id='external-events'>

    <p>

      <strong>Draggable Events</strong>

    </p>


    <?php

    require 'draggableevents.php';

    $events = getDraggableEvents();

    foreach ($events as $event)

    {

    ?>

      <div class='fc-event'><?php echo $event['EventName']; ?></div>

    <?php

    }

    ?>


    <p>

      <input type='checkbox' id='drop-remove' />

      <label for='drop-remove'>remove after drop</label>

    </p>

  </div>

  <div id='calendar-container'>

    <div id='calendar'></div>

   </div>

</body>

</html>


查看完整回答
反對(duì) 回復(fù) 2024-01-03
  • 1 回答
  • 0 關(guān)注
  • 172 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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