나는 동적 사용자 통계의 서명 작업을하고 있습니다.동적 이미지에 mysql 데이터 표시
여기 내 코드입니다 : 내가 이것을 변경하는 경우 이
<?php
//Send a generated image to the browser
$config->Host = 'localhost';
$config->User = 'grpg';
$config->Pass = 'E8vspAcP';
$config->DB = 'grpg_wp';;
$con = mysql_connect($config->Host,$config->User,$config->Pass);
if (!$con) die('<div class="errorbox">Nepavyko prisijungti prie duomenu bazes: '. mysql_error() .'</div>');
mysql_select_db($config->DB, $con);
$query = mysql_query("SELECT * FROM serverplayers WHERE id=1");
$showuser = mysql_fetch_assoc($query);
$user1 = $showuser['User'];
$user="$user1"; // or the value from your database
create_image($user);
function create_image($user)
{
//Set the image width and height
$width = 100;
$height = 20;
//Create the image resource
$image = ImageCreate($width, $height);
//We are making three colors, white, black and gray
$white = ImageColorAllocate($image, 255, 255, 255);
$black = ImageColorAllocate($image, 0, 0, 0);
$grey = ImageColorAllocate($image, 204, 204, 204);
//Make the background black
ImageFill($image, 0, 0, $black);
//Add randomly generated string in white to the image
ImageString($image, 3, 30, 3, "$user", $white);
//Tell the browser what kind of file is come in
header("Content-Type: image/jpeg");
//Output the newly created image in jpeg format
ImageJpeg($image);
//Free up resources
ImageDestroy($image);
}
?>
업데이트 : $pass = "$user";
$pass = "erlis";
이 내 이름 표시 문제없이. 여기 거래는 뭐니? 이미지가 멋지게 표시되지만 텍스트가 없습니다. 알아낼 수 없습니까?
'var_dump ($ show ['User ']);'출력은 무엇입니까? –