如果is_numeric条件问题


if is_numeric condition issue

我有一个http_build_query数组和file_get_contents,如下所示:

 $optionValues = http_build_query( array( 
                   'leadcomm' => getVariable('LEADCOMM'),  
                   'CCID' => getVariable('CCID'),
                   'QTR' => getVariable('QTR'),
                   'CLK' => getVariable('CLK'),
                   'dck' => getVariable('DCK'),
                   'bal_one' => getVariable('BAL_ONE'),
                   'product' => getVariable('PRODUCT'),
                   'prop_st' => getVariable('PROP_ST'),
                   'cred_grade' => getVariable('CRED_GRADE'),
                   'prop_zip' => getVariable('PROP_ZIP'),
                   'prop_desc' => getVariable('PROP_DESC'),
                   'spec_home' => getVariable('SPEC_HOME'),
                   'purchase_contract' => getVariable('PURCHASE_CONTRACT'),
                   'est_val' => getVariable('EST_VAL'),
                   'down_pmt' => getVariable('DOWN_PMT'),
                   'loan_type' => getVariable('LOAN_TYPE'),
                   'buy_timeframe' => getVariable('BUY_TIMEFRAME'),
                   'agent_found' => getVariable('AGENT_FOUND'),
                   'va_status' => getVariable('VA_STATUS'),
                   'income' => getVariable('INCOME'),
                   'annual_verifiable_income' => getVariable('ANNUAL_VERIFIABLE_INCOME'),
                   'fha_bank_foreclosure' => getVariable('FHA_BANK_FORECLOSURE'),
                   'num_mortgage_lates' => getVariable('NUM_MORTGAGE_LATES'),
                   'email' => getVariable('EMAIL'),
                   'fname' => getVariable('FNAME'),
                   'lname' => getVariable('LNAME'),
                   'address' => getVariable('ADDRESS'),
                   'city' => getVariable('CITY'),
                   'state' => getVariable('STATE'),
                   'zip' => getVariable('ZIP'),
                   'pri_phon' => getVariable('PRI_PHON'),
                   'sec_phon' => getVariable('SEC_PHON'),
                   'capture_method' => getVariable('CAPTURE_METHOD'),
                   'aid' => getVariable('AID'),
                   'srlp' => getVariable('SRLP'),
                   'scid' => getVariable('SCID'),
                   'buyer_id' => getVariable('BUYER_ID'),  
                   'cid' => getVariable('CID'), 
                   'ppcid' => getVariable('PPCID')
                    )
               );

            $url = 'http://api.example.com/import-lead-data.php';  
            $options['http'] = array(
                            'method' => "POST", 
                            'header'  => 'Content-type: application/x-www-form-urlencoded',
                            'content' => $optionValues,
                            );    
            $context = stream_context_create($options);    
            $result = file_get_contents($url, NULL, $context);

我需要检查$results是否返回数值。 如果是这样,我需要将一个新变量 ($lead_id( 设置为等于 $results,通过另一个http_build_query数组传递 $lead_id,最后再做一次file_get_contents $results。 上面的代码工作正常。 代码的第二部分是我需要一些帮助的地方。 这是我对代码第二部分的内容:

if (is_numberic($result)) {
                $lead_id(isset($results));
            };
$leadValues = http_build_query( array( 
                    'lead_id' => "LEAD_ID"
                    )
               );
            $leadurl = 'http://api.bankradar.com/import-lead-response.php';  
            $leadoptions['http'] = array(
                            'method' => "POST", 
                            'header'  => 'Content-type: application/x-www-form-urlencoded',
                            'content' => $leadValues,
                            );    
            $leadcontext = stream_context_create($leadoptions);    
            $leadResult = file_get_contents($leadurl, NULL, $leadcontext);

我认为我的问题出在代码的 isset 部分,但我不确定。

你把

if (is_numberic($result)) {

应该是

if (is_numeric($result)) {

但是,我使用这种方式

 if (ctype_digit($result)) {

这样它只能包含数字,没有小数或任何其他字符......不确定这是否是你的追求

你正在调用 $lead_id 作为一个函数。只需更改

$lead_id(isset($results));

$lead_id = $results;

你拼错了is_numeric(你的有一个b( - is_num b埃里克