SQLSTATE[HY000][2002]没有这样的文件或目录



我的代码PHP, torneo.db文件没有找到

<?php
chmod("torneo.db", 0755); //permissions
$result = [
'ok' => false,
'message' => 'no se pudo agregar los datos'
];
class MyDB extends SQLite3
{
function __construct()
{
$this->open('torneo.db'); //here
}
}

function fetchUrl($uri, $timeout = 10) {
try {
$handle = curl_init();
curl_setopt($handle, CURLOPT_URL, $uri);
curl_setopt($handle, CURLOPT_POST, false);
curl_setopt($handle, CURLOPT_BINARYTRANSFER, false);
curl_setopt($handle, CURLOPT_HEADER, true);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($handle, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($handle, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($handle, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36');
$response = curl_exec($handle);
$hlength  = curl_getinfo($handle, CURLINFO_HEADER_SIZE);
$httpCode = curl_getinfo($handle, CURLINFO_HTTP_CODE);
$body     = substr($response, $hlength);
if ($httpCode != 200) {
throw new Exception("HTTP code: " . $httpCode);
}
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
$body = false;
} finally {
curl_close($handle);
}
return $body;
}

$data = trim($_GET['nombredeinvocador']);
$id = preg_replace('/s+/', '%20', $data);
$pos = false;
//require_once("acentos.php");
try{
$url = "https ://www.l eagueofgraphs.com/es/summoner/lan/" . urlencode($id);
$page = fetchUrl($url);
if(!$page){
throw new Exception("Error al obtener la pagina");
}
$findme = $id;
$pos = strpos($page, $findme);
if($pos === false){
throw new Exception("Invocador no encontrado");
}
}catch(exception $ex){
$result['pageError'] = $ex->getMessage();
}


if ($pos === false) {
die(json_encode($result));


} else {
try {
//para los graciosos que no quieren colocar su pais
$opciones = array("argentina", "bolivia", "brasil", "chile", "colombia", "costa_rica", "cuba", "ecuador", "el_salvador", "guatemala", "haiti", "honduras", "mexico", "nicaragua", "panama", "paraguay", "peru", "republica_dominicana", "uruguay", "venezuela");
if ( in_array($_GET['pais'], $opciones)) {
$pais = $_GET['pais'] ;
} else {
$pais = "Maricolandia";
}

$db = new MyDB();
$statement = $db->prepare("INSERT INTO participantes (nombrereal, nombredeinvocador , pais) VALUES (:nombrereal, :nombredeinvocador ,:pais)");
$statement->bindValue(':nombrereal', $nombrereal);
$statement->bindValue(':nombredeinvocador', $nombredeinvocador);
$statement->bindValue(':pais', $pais);
try {
$statement->execute();
if($db->lastErrorCode() == 0){
$result['id'] = $db->lastInsertRowID();
$result['ok'] = true;
$result['message'] = 'Se ha registrado correctamente.';
echo $result['message'];
}
} catch(PDOException $e) {
$result['codeError1'] = $e->getCode();
$result['codeError2'] = $statement->errorCode();
if($e->getCode() == 1062 or $statement->errorCode() == 23000){
$result['message'] = 'El invocador ya se encuentra registrado';
}else{
$result['message'] = $e->getMessage();
}
}
}catch(PDOException $e){
//echo $e->getMessage(); 
$result['message'] = $e->getMessage();    
}
}
?>

我有我在标题中指出的错误,即使给予超级用户权限才能管理它,我不明白是什么错了。驱动程序Sqlite或扩展是可用的,我使用php info.

同一个目录,找不到它…

Sqlite3

Sqlite3

Sqlite3

Sqlite3

php file exist

奇怪的是,我试着在另一个文件中使用它来测试,如果我能读取文件和它包含的信息

我甚至使用php函数来检查文件是否存在,如果它在那里我的搜索结果在我的torneo.db文件

chaoticsystem Array ([0] =>1 [id] =>1 1 =>混沌系统[nombrereal] =>混沌系统2 =>混沌系统[nombredeinvocador] =>混沌系统3 =>委内瑞拉[pais] =>委内瑞拉)

我的问题是有两个文件叫做connect.php,一个在索引所在的目录,另一个是我使用的,但在另一个文件夹…

相关内容

最新更新