【发布时间】:2018-04-30 01:54:23
【问题描述】:
我已经编写了两个 laravel 应用程序。 FirstApp 和 CryptoApp(分别为应用名称)
我在其中将加密文本发送到 CryptoApp 中一个名为 (Decrypt) 的函数,该函数应该返回解密的文本
在 FirstApp 中,我将带有加密文本的 curl POST 请求发送到 CryptoApp
cURL 邮政编码: 在 FirstApp 中
private function DecryptApi($data)
{
$ch = curl_init(); // initiate curl
$url = "http://crypto.dev/Decrypt"; // where you want to post data
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST, true); // tell curl you want to post something
curl_setopt($ch, CURLOPT_POSTFIELDS, "data=".$data); // define what you want to post
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // return the output in string format
$output = curl_exec ($ch); // execute
curl_close ($ch); // close curl handle
return $output; // show output
}
路线: Route::post('/Decrypt','CryptoController@Decrypt');
功能:
public function Decrypt(Request $request)
{
$crypt = Crypto::find(1);
return openssl_decrypt($request['data'],"AES-256-CBC",$crypt->secretKey,0,$crypt->iv);
}
我得到的错误是: "SQLSTATE[42S02]: Base table or view not found: 1146 Table 'laravel_firstapp.crypto' 不存在(SQL: select * from crypto其中crypto.id = 1 限制 1)"
这个错误让我很困惑,因为我知道 FirstApp 没有名为“crypto”的表,但 CryptoApp 有,为什么 laravel 没有返回我想要的文本?
【问题讨论】:
-
你有关于这个问题的更新吗??我想我也面临同样的问题
标签: laravel