好的。我是 PHP 中的类的新手,并试图将变量传递给类中的受保护函数。我该怎么做呢?
类.PHP
<?php
include($_SERVER['DOCUMENT_ROOT']."/includes/con.php");
class gindex {
protected function rdev($a,$b,$c,$d){
$d = base64_encode($d);
mysql_query("INSERT INTO mem(first_name,last_name,email,password,type) VALUES(".$a.",".$b.",".$c.",".$d.",'developer')", $db);
}
?>
索引.PHP
<?php
include($_SERVER['DOCUMENT_ROOT']."/includes/con.php");
if(isset($_POST['developerbtn'])){
$fname = $_REQUEST['fname'];
$lname = $_REQUEST['lname'];
$email = $_REQUEST['email'];
$password = $_REQUEST['password'];
$Cgindex = new gindex();
$Cgindex->rdev($fname,$lname,$email,$password);
}
?>