简体   繁体   English

PHP-MYSQL存储过程输出参数

[英]PHP - MYSQL Stored Procedure Out Parameter

I have a mysql stored procedure that takes 3 parameters - 2 In and 1 out I am calling this procedure from php using mysqli 我有一个采用3个参数的mysql存储过程-2 in和1 out我正在使用mysqli从php调用此过程

The procedure will return 1 row and I use the following code when calling it 该过程将返回1行,调用时将使用以下代码

    $result = $mysqli->query("call get_hybrid_auth_session('".$userId."','".$loginSystem."', @hybridAuthSession)");
    $result = $mysqli->query( 'SELECT @hybridAuthSession' );
    $row = $result->fetch_object();

When I do a var_dump on the $row attribute, I get the following text back 当我在$ row属性上执行var_dump时,我得到以下文本

object(stdClass)#16 (1) { ["@hybridAuthSession"]=> string(287) ".a:3:{s:40:"hauth_session.twitter.token.access_token";s:56:"s:48:"23801232-fkv05uitVRobpItrFFUn15I4Ejl0w80pr7GOH0A";";s:47:"hauth_session.twitter.token.access_token_secret";s:51:"s:43:"VKsFaQWnP8n9OcZK3MDCgRHQY0roLTFVXesBuONCYJo";";s:34:"hauth_session.twitter.is_logged_in";s:4:"i:1;";}." } 

When I do a var_dump on the $row->{"@hybridAuthSession"} attribute, I get the following value back 当我在$ row-> {“ @ hybridAuthSession”}属性上执行var_dump时,返回以下值

string(287) ".a:3:{s:40:"hauth_session.twitter.token.access_token";s:56:"s:48:"23801232-fkv05uitVRobpItrFFUn15I4Ejl0w80pr7GOH0A";";s:47:"hauth_session.twitter.token.access_token_secret";s:51:"s:43:"VKsFaQWnP8n9OcZK3MDCgRHQY0roLTFVXesBuONCYJo";";s:34:"hauth_session.twitter.is_logged_in";s:4:"i:1;";}."

Is there any way to not receive the string(287) value at the start? 有什么办法在开始时不接收string(287)值? The hybridAuthSession Out parameter is defined as Text in my stored procedure hybridAuthSession Out参数在我的存储过程中定义为Text

Var dump was adding additional information when outputting the text to the screen which is its expected behaviour. Var dump在将文本输出到屏幕时正在添加其他信息,这是它的预期行为。 After some more tests, the code was working as expected 经过更多测试后,代码按预期工作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM