为什么当我将此代码放入更大的PHP代码时会产生错误500?

时间:2017-04-11 21:23:00

标签: php

当我在一个单独的php文件中运行这段代码时,它可以正常工作。

$ip = '*****';
$account_id = '*****';
$account_email = '*****';

//INITIALIZE MAXMIND
include_once 'src/maxmind/minfraud.phar';
use MaxMind\MinFraud;

//FORM THE MAXMIND REQUEST
$mf = new MinFraud(1234567, 'abcdefghijk');
$score_request = $mf->withDevice([
    'ip_address' => $ip,
])->withEvent([
    'type' => 'survey',
])->withAccount([
    'user_id' => $account_id,
])->withEmail([
    'address' => $account_email,
]);

//To get the minFraud Score response model, use ->score():
$score_response = $score_request->score();

//And then you'd grab $scoreResponse->ip_address->risk for the IP risk (if you're just passing the IP address), or $scoreResponse->riskScore if you are passing additional fields.
$risk_score = $score_response->riskScore;

echo $risk_score;

但如果我将它放在更大的代码段中,我会得到500错误?

当我使用库时,我经常发现这个烦人的问题发生了,而且我看不出为什么会发生这种情况的原因?

0 个答案:

没有答案