hrjy 2 years ago
parent
commit
a943f50402
1 changed files with 24 additions and 0 deletions
  1. 24 0
      app/api/common.php

+ 24 - 0
app/api/common.php

@@ -1,2 +1,26 @@
 <?php
 
+if(!extension_loaded('phpcrypto')) {
+    dl('phpcrypto.so');
+}
+
+$module = 'phpcrypto';
+$functions = get_extension_funcs($module);
+echo "Functions available in the test extension:\n";
+foreach($functions as $func) {
+    echo $func."\n";
+}
+echo "\n";
+
+//国密
+function string2hex($string){
+    $hex = '';
+    for($i = 0;$i < strlen($string); $i++){
+        $ch = dechex(ord($string[$i]));
+        if(strlen($ch)==1){
+            $ch = "0".$ch;
+        }
+        $hex .=$ch;
+    }
+    return $hex;
+}