-2
$string .= '(\''.$idURL.'\', \''.$premierP.'\', \''.$prefixe.'\', \''.$matches1['0'].'\', \''.$matches2[0].'\'),\\n';
在一個文件(construt SQL線)與file_put_contents($file, $string);
,但它不能正常工作,有什麼不對?
$string .= '(\''.$idURL.'\', \''.$premierP.'\', \''.$prefixe.'\', \''.$matches1['0'].'\', \''.$matches2[0].'\'),\\n';
在一個文件(construt SQL線)與file_put_contents($file, $string);
,但它不能正常工作,有什麼不對?
這對我很有用。我已經測試如下。
<?php
$file = 'test.txt';
$idURL ='test';
$premierP = 'test';
$prefixe = 'test';
$matches1['0'] = 'test';
$matches2[0] = 'test';
$string .= '(\''.$idURL.'\', \''.$premierP.'\', \''.$prefixe.'\', \''.$matches1['0'].'\', \''.$matches2[0].'\'),\\n';
file_put_contents($file, $string);
?>
沒有什麼不對的,除了可能增加一倍單引號逃逸'\ N'和擁有它,而不是增加一倍(在單一的'\ N') – 2014-09-03 12:51:05
你知道你可以混合使用單引號雙避免反斜槓混亂?即'foo(''bar'')'(SO打破這個)而不是'foor('\'bar'')' – 2014-09-03 12:55:41
定義「不起作用」。那是什麼意思?它有什麼作用?任何錯誤? *什麼*? – deceze 2014-09-03 13:00:12