-1
$xmlSend = <<<TEXT
                    <?xml version="1.0" encoding="UTF-8"?>
                        <VMCAMEXM>
                            <business>
                                <id_company>{$idCompany}</id_company>
                                <id_branch>{$idBranch}</id_branch>
                                <country>{$Country}</country>
                                <user>{$User}</user>
                                <pwd>{$pwd}</pwd>
                            </business>
                            <transacction>
                                <merchant>{$Merchant}</merchant>
                                <reference>50000</reference>
                                <tp_operation>13</tp_operation>
                                <creditcard>
                                    <crypto>{$Crypto}</crypto>
                                    <type>V/MC</type>
                                    <name>{$name}</name>
                                    <number>{$number}</number>
                                    <expmonth>{$expmonth}</expmonth>
                                    <expyear>{$expyear}</expyear>
                                    <cvv-csc>{$cvv}</cvv-csc>
                                </creditcard>
                                <amount>{$cantidad}</amount>
                                <currency>{$Currency}</currency>
                                <usrtransacction>1</usrtransacction>
                            </transacction>
                        </VMCAMEXM>
TEXT;

echo "<pre>";
print_r(htmlspecialchars($xmlSend));
echo "</pre>";

            //$url = $tUrl;         
            $vars = "&xml=" . $rc4->limpiaVariable(urlencode($xmlSend)); 
            $header[] = "Content-type: application/x-www-form-urlencoded";
            $ch = curl_init();
            $postfields = "info_asj3=1".$vars;

             curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
             curl_setopt($ch, CURLOPT_URL,$Url);
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
             curl_setopt($ch, CURLOPT_TIMEOUT, 250);
             curl_setopt($ch, CURLOPT_POST, true);
             curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
             curl_setopt($ch, CURLOPT_HTTPHEADER, $header);          

             $data = curl_exec($ch);
                if (curl_errno($ch)) {
                   $data = curl_error($ch);          
                } else {
                   curl_close($ch);
                }

これを使用してxmlフィードに接続している新しい会社と協力しています。しかし、この冒頭を使用<<<TEXTすると、その下のすべてのコードが台無しになります。エラーは発生しません。コードは機能しますが、以下の私のphpコードはすべて黒字で、正直言って管理が簡単ではありません. それを取り出すと、xml フィードが正しく機能しません。なぜこれが機能しているのか、これを達成するためのより良い方法は何か教えてもらえますか? 私はどこでも検索しましたが、トピックに関するものは何も見つかりません。助けてください!

時間を割いて回答してくださった皆様、ありがとうございました。


portaudio を使用したサウンド カードへのマルチ オーディオ トーン

サウンド カードにトーンを生成しようとしています (周波数: 1950 hz、持続時間: 40 ms、レベル: -30 db、右チャンネル (ステレオ)、蒸気 1)。最終的には、これらのトーンを 2 つ再生したいと考えています (1 つはチャンネル 1 に、もう 1 つはチャンネル 2 に行きます)。

どんな助けや指示も大歓迎です。

ありがとう、DW


こんにちはビョルン、私はこれを試しましたが、周波数として期待しているものを取得していません (さらに、音がきれいではないようです)。何が問題なのですか?助けていただければ幸いです。

#define SAMPLE_RATE   (44100)
#define TABLE_SIZE   (200)
float FREQUENCY = 422;

...
for(int i=0; i<TABLE_SIZE; i++ )
{
    data.sine[i] = (float) sin( (double)i * ((2.0 * M_PI)/(double)SAMPLE_RATE) * FREQUENCY );
}

data.left_phase = 0;
data.right_phase = 0;
...

... in callback function ...
for(unsigned long i = 0; i < framesPerBuffer; i++ )
{   

  // fill output buffer with sin wave
  *out++ = data->amp * data->sine[data->left_phase];  // left     
  *out++ = data->amp * data->sine[data->right_phase]; // right                  

  data->left_phase += 1;    

  if( data->left_phase >= TABLE_SIZE ) 
    data->left_phase -= TABLE_SIZE;           

  data->right_phase += 1; 

  if( data->right_phase >= TABLE_SIZE ) 
    data->right_phase -= TABLE_SIZE;
} 
4

2 に答える 2

2

これは文字列のヒアドキュメント構文です。

文字列にヒアドキュメントを使用すると、複数行の文字列にメリットがあり、引用符の問題を回避できます。

于 2012-09-27T01:41:11.847 に答える
0

これはHEREDOC文字列です。問題が発生している場合は、終了シーケンスのインデントが原因である可能性があります。

文章; //<-テキストファイルの0番目の列にある必要があります。

http://php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc

于 2012-09-27T01:42:32.550 に答える