2017-09-16 4 views
2

점점 선언되지 않은 경우에도 내가 추가 UTF-8 이미 HMTL 헤드에 추가추가 된 메타 태그 UTF 8 만 HTML 문서의 문자 인코딩이 아직도 내가 콘솔에서 오류가 발생하고

The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must be declared in the document or in the transfer protocol.

. 그때 제대로

참고 일하고 HTML에서 내 PHP 코드를 아래로 삭제 한 경우

<meta content="text/html;charset=utf-8" http-equiv="Content-Type"> 
<meta content="utf-8" http-equiv="encoding"> 

는 : $GET['Key'] 값 아래에 암호 해독에 내 ID의 암호를 변경하는 기능이고 URL(domain.com/details?key=uYxnJrS3aLv0JbJFLnnmW4TRRpF6%2FYB0JD6LUhPYu0U%3D)

if ($conn->real_escape_string($_GET['key'])){ 
    $p_id=$conn->real_escape_string($_GET['key']); 
    $decrypted_p_id = decryptIt($p_id); 
    /*display single products*/ 
    $sql_single_products="SELECT p_images, p_name, p_company, p_status FROM products WHERE p_id=?"; 
    if ($stmt = $conn->prepare($sql_single_products)) { 
      $stmt->bind_param("i", $decrypted_p_id); 
      $stmt->execute(); 
      $stmt->bind_result($p_images, $name,$company,$status); 
      $stmt->fetch(); 
    } 
} 

에서 온다 부본 및 그 반대로

function encryptIt($q) { 
    $cryptKey = 'qJB0rGtIn5UB1xG03efyCp'; 
    $qEncoded  = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($cryptKey), $q, MCRYPT_MODE_CBC, md5(md5($cryptKey)))); 
    return($qEncoded); 
} 

function decryptIt($q) { 
    $cryptKey = 'qJB0rGtIn5UB1xG03efyCp'; 
    $qDecoded  = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($cryptKey), base64_decode($q), MCRYPT_MODE_CBC, md5(md5($cryptKey))), "\0"); 
    return($qDecoded); 
} 

Connection.php

$servername = "localhost"; 
$username = "user"; 
$password = "Pass#@123"; 
$dbname = "dbname"; 
// Create connection 
$conn = new mysqli($servername, $username, $password, $dbname); 
$conn->set_charset('utf8'); 
// Check connection 
if ($conn->connect_error) { 
    die("Connection failed: " . $conn->connect_error); 
} 

을 얻기도를 작성해야 ini_set('display_errors', 1); 다음 나는 오류

Allowed memory size of 268435456 bytes exhausted (tried to allocate 4294967296 bytes) 
+0

은 charset에 utf8로 사용되는 데이터베이스입니까? – Ramadhan

+0

잘 모르겠습니다. 어디에서 설정해야합니까? –

+0

phpmyadmin을 실행하고 데이터베이스 목록을보십시오. 거기에있는 문자셋에 대한 정보가 있습니다 – Ramadhan

답변

0

마지막으로, 내 대답을 찾았 어. 내가 한 것은 public_html 폴더에 php.ini 파일을 만들고 여기에 코드를 추가했습니다.

memory_limit = 512M // before it was 256M if you want to check the current limit then add `php_info();` in your PHP file then run your file.and find memory_limit. 
post_max_size = 32M; 
upload_max_filesize = 32M; 

그래도 여전히 문제가 발생했습니다. 그때 준비된 문을 사용했다 나는 $stmt->bind_result() 전에

$stmt->store_result(); 

을 추가하고이 시간이 perfeclty을 일하고 있었다.

사람이 같은 문제는 다음이 해결 방법을 시도해보십시오 얻는 경우.

0

을 얻고 추가 ​​데이터베이스 연결 파일에 $conn->set_charset('utf8');을 추가 한 후 :

<meta charset="utf-8" /> 
+0

그뿐만 아니라 동일한 문제가 발생했습니다. –

+0

DataBase charset을 확인해야합니다. DB와의 연결을 만들 때 다음과 같이 기본 문자셋을 설정합니다 :'$ conn-> set_charset ('utf8')' –

+0

DB에서 위의 문자 세트를 추가 한 후에 다른 오류가 발생합니다. 치명적인 오류 : 134217728 바이트의 사용 가능한 메모리 크기 (4294967296 바이트를 할당하려고 시도 함) –