伙计我是Python的新手,甚至更多的Django,请理解我的限制.我正在尝试使用Django身份验证模块,并在我的视图上出错
出现以下错误:未定义全局名称"RequestContext"
这是代码:
def register(request):
# Like before, get the request's context.
context = RequestContext(request)
# A boolean value for telling the template whether the registration was successful.
# Set to False initially. Code changes value to True when registration succeeds.
registered = False
# If it's a HTTP POST, we're interested in processing form data.
if request.method == 'POST':
# Attempt to grab information from the raw form information.
# Note that we make use of both UserForm and …Run Code Online (Sandbox Code Playgroud) 团队,我正在尝试在 mysql 数据库中插入一个寄存器,并且在使用 mysqli 时出现错误 execute()
注意:C:\xampp\htdocs\InsereSite.php 中第 19 行的数组到字符串的转换 Call Stack execute () ..\InsereSite.php:19
我不确定为什么它会尝试进行这种转换,但无论如何,这是代码。请告诉我更多的数据。
<?php
function InsertSiteDb($site_novo){
if(!isset($_POST['sites'])) {
echo " Voce precisa estar logado para acessar essa pagina";
header('Location:sellsite_login.html');
}else{
$mysqli = new mysqli('localhost', 'root', '', 'sellsites');
$query = "INSERT INTO pages (url,file,public,price) VALUES (?,?,0,0)";
$stmt = $mysqli->prepare($query);
$stmt->bind_param('ss',$_SESSION['url'],$_SESSION['nomesite']);
//$stmt->execute();
$stmt->close();
}
}
?>
Run Code Online (Sandbox Code Playgroud)
这里是调用 InsertSiteDb 的地方:
<?php
session_start();
$sites = $_POST['sites']; //o que foi digitado no form será postado
var_dump($sites);
$sites = explode(";",$sites);
foreach ($sites as …Run Code Online (Sandbox Code Playgroud)