I have declared a structure that look like
typedef struct
{
char* key;
char* value;
}kvPair;
and in the session structure, i declared a variable as
struct session
{
char* id;
..... // other session variables
kvPair* pair;
}
Now in the session_start I have initialised the values for the pair variable and I have to access these values in /ext/mysql extension. A suggestion on how to achieve it woul开发者_StackOverflow中文版d be greatly appreciated
I'm not sure what you're trying to do, but if you want to read data that was saved in the session e.g. through this script:
<?php
session_start();
$_SESSION["key"] = "data";
Then yes, you can use the API exposed by the session extension:
#include "ext/session/php_session.h"
Then you have these functions:
void php_session_start(TSRMLS_D); /* analogue to session_start() in userspace */
int php_get_session_var(char *name, size_t namelen, zval ***state_var TSRMLS_DC);
精彩评论