⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 1-5.php

📁 《php程序设计》的配套源码 《php程序设计》的配套源码 《php程序设计》的配套源码 《php程序设计》的配套源码
💻 PHP
字号:
<?php
if (isset($_GET['message'])) {
  // load font and image,calculate width of text
  $font = 'times';
  $size = 12;
  $im = ImageCreateFromPNG('button.png');
  $tsize = imagettfbbox($size, 0, $font, $_GET['message']);
  // center
  $dx = abs($tsize[2]-$tsize[0]);
  $dy = abs($tsize[5]-$tsize[3]);
  $x = (imagesx($im)-$dx)/2;
  $y = (imagesy($im)-$dy)/2 + $dy;
  // draw text
  $black = ImageColorAllocate($im, 0, 0, 0);
  ImageTTFText($im, $size, 0, $x, $y, $black, $font, $_GET['message']);
  // return image
  header('Content-type: image/png');
  ImagePNG($im);
  exit;
}
?>
<html>
<head><title>Button Form</title></head>
<body>
<form action="<?= $PHP_SELF ?>" method="GET">
Enter message to appear on button:
<input type="text" name="message" /><br />
<input type="submit" value="Create Button" /></form>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -