The structure of the $key object returned from the database, which you gave in the comments is:
array(1) { [0]=> object(stdClass)#1743 (1) { ["keyy"]=> string(6) "rKSpxf" } }
This is an array with a single element at index 0. This element is an object with a single property "keyy".
Therefore to access the data and output it, you need to write:
echo $key[0]->keyy;
The [0]
references the first index of the array, and the ->keyy
references the "keyy" property of the object in that index.
To make clearer what's going on, you could write it longhand like this:
$obj = $key[0]; //get the object out of the array
$prop = $obj->keyy; //get the property out of the object
echo $prop; //output the value of the property
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…