草庐IT

data-parameter

全部标签

php - MVC : Why bother "sending" data to the View

我是MVC的新手,所以我一直在网上搜索以尝试构建我自己的框架以真正了解整个概念的工作原理。无论如何,几乎所有处理MVC的教程似乎总是将需要在View中显示的数据分配给然后在View中使用的中间变量。我的问题是,为什么要费心去做那个额外的步骤?大多数MVC实现最终都将View包含在Controller中...所以如果是这样,为什么要浪费时间/内存/cpu周期来创建一个中间变量/数组,然后在View结束时将其传递给View最后包含在Controller中。直接在View中直接使用Controller变量不是更有意义吗?下面是一个代码示例,希望能阐明我的意思:classNews_Contro

php - 邮件程序错误 : SMTP Error: The following SMTP Error: Data not accepted

下面的代码给出了消息MailerError:SMTPError:ThefollowingSMTPError:Datanotaccepted.ButwhenIreplace$EmailAddwithaa@yahoo.com.Themailwassent.我的代码有什么问题?我是php的新手,尤其是在处理邮件功能方面。$sql1="SELECTEmail_AddressFROMparticipantablewhereIDno=$studId";$result1=mysql_query($sql1);while($row1=mysql_fetch_assoc($result1)){$Emai

php - AMQPRuntimeException : Error reading data. 收到 0 而不是预期的 7 字节

它一直在工作,但现在它不再工作了!我正在使用php-amqplib和RabbitMQ。当我尝试创建一个新的AMQP连接时:$connection=newAMQPConnection('localhost',5672,'username','password');库中导致此错误的代码是:publicfunctionread($n){$res='';$read=0;while($readsock)&&(false!==($buf=fread($this->sock,$n-$read)))){if($buf===''){continue;}$read+=strlen($buf);$res.=

php - 警告 : date() expects parameter 2 to be long, 中给出的字符串

我在我的数据库的car_detail.php页面上不断收到这个错误Warning:date()expectsparameter2tobelong,stringgivenin/home/speedycm/public_html/speedyautos/cars_class.phponline228*cars_class.php在第228行读取这个$this->expiry_date=date("m/d/Y",$rows['expiry_date']);我该如何解决这个问题? 最佳答案 date()需要一个unix时间戳...我想您正在

php - zf2 插入使用 $db->insert($table, $data);风格

您好,有什么方法可以在zf2上使用zf1样式将数据插入到数据库表中吗?$db->insert('tablename',$data);其中$data是一个包含(列、值)的关联数组谢谢 最佳答案 在zf2中插入:useZend\Db\Sql\Sql;$sql=newSql($this->dbAdapter);$insert=$sql->insert('table');$newData=array('col1'=>'val1','col2'=>'val2','col3'=>'val3');$insert->values($newData)

php - 给出警告 : mysql_result() expects parameter 1 to be resource, bool 值

我知道我们已经有很多关于这个错误的问题,但我无法修复我的代码,所以这里的任何人都请帮助我解决这个问题。我的代码是这样的functionlogin($username,$password){$user_id=user_id_from_username($username);$username=sanitize($username);$password=md5($password);return(mysql_result(mysql_query("SELECTCOUNT(`user_id`)FROM`users`WHERE`username`='$username'AND`password

PHP 替代 mysql_data_seek for ODBC

我正在将PHP-mySQL应用程序转换为PHP-ODBC应用程序。即将数据库从mysql迁移到DB2。在使用mysql时,我使用了mysql_data_seek函数来重置记录集指针,但这不适用于ODBC连接。我尝试并检查了odbc_fetch_row($recordset,0)以重置记录集,但这不起作用。有谁知道如何通过ODBC连接重置记录集? 最佳答案 根据thedocs,您需要传递1作为第二个参数而不是0。Tostepthroughtheresultmorethanonce,youcancallodbc_fetch_row()w

php - Symfony - NelmioApiDocBundle : Show parameter description imported from class

我正在使用NelmioApiDocBundle连同用于RESTAPI的PHP框架Symfony3。我想在/api/doc页面中显示我的参数的描述。如果不手动添加参数,这可能吗?我想从输入/输出类中导入它。这是我的文档的样子:这是生成文档的Controller操作(/api/user/login)的@ApiDoc:*@ApiDoc(*section="user",*resource=true,*description="Checkstheusercredentialsandreturnsanauthentication&refreshtokeniftheyarecorrect",*inp

php - Laravel $request->all() 使用 multipart/form-data 为空

我发送的请求包括表单数据对象,其中包含一些从angular4到laravelapi的数据......有时请求数据被正确接收,其他时候请求为空“空请求”这是我的请求详情Accept:application/jsonAccept-Encoding:gzip,deflate,brAccept-Language:en-US,en;q=0.9Authorization:Bearer---------Connection:keep-aliveContent-Length:973Content-Type:multipart/form-data;boundary=----WebKitFormBound

php - get the key parameter is not a valid public key 错误在 openssl_public_encrypt()

$publicKey="../ssh/public/pub";$plaintext="要加密的字符串";$pubKey=openssl_pkey_get_public($publicKey);openssl_public_encrypt($plaintext,$encrypted,$pubKey);echo$encrypted;//encryptedstring以上代码产生以下错误openssl_public_encrypt()[http://php.net/function.openssl-public-encrypt]:key参数不是有效的公钥[APP/controllers/su