跳至主內容區

XOOPS輕鬆架

:::

主內容區域

選擇後會自動跳轉頁面

1-2 save.php

<?php
$db = new mysqli('localhost', 'root', '12345', 'test');
if ($db->connect_error) {
    die('無法連上資料庫:' . $db->connect_error);
}
$db->set_charset("utf8");

$type    = $db->real_escape_string($_POST['sig'][0]);
$content = $db->real_escape_string($_POST['sig'][1]);

$sql = "INSERT INTO `canvas` (`type`, `content`) VALUES ('{$type}', '{$content}')";
$db->query($sql) or die($db->error);
$sn = $db->insert_id;

if (strpos($type, 'svg') !== false) {
    file_put_contents("{$sn}.svg", $_POST['sig'][1]);
} else {
    $data = base64_decode($_POST['sig'][1]);
    file_put_contents("{$sn}.png", $data);
}

echo $sn;

 

選擇後會自動跳轉頁面

:::

左邊區域內容

書籍目錄

展開 | 闔起

快速登入


右邊區域內容

請掃此 QR Code 可連至此頁面

計數器

今天: 444444444
昨天: 2266226622662266
總計: 9545549954554995455499545549954554995455499545549

頁尾區域