我有问题在Redirect :: route中传递带有"with"的两个变量...这是我的代码...
这该怎么做
return Redirect::route('cart-success')->with(
array(
'cartSuccess' => 'You successfuly ordered. To track your order processing check your email',
'cartItems' => Cart::contents()
)
);
Run Code Online (Sandbox Code Playgroud)
这是错误:
未定义的变量:cartItems(查看:C:\ xampp\htdocs\laravel-webshop\laravel\app\views\cart-success.blade.php)
Route::group(array('before' => 'csrf'), function() {
//Checkout user POST
Route::post('/co-user', array(
'as' => 'co-user-post',
'uses' => 'CartController@postCoUser'
));
});
Run Code Online (Sandbox Code Playgroud)
CONTROLLER
public function postCoUser() {
$validator = Validator::make(Input::all(), array(
'cardholdername' => 'required',
'cardnumber' => 'required|min:16|max:16',
'cvv' => 'required|min:3'
));
if($validator->fails()) {
return Redirect::route('checkout')
->withErrors($validator)
->withInput();
} else {
return Redirect::route('cart-success')->with(
array(
'cartSuccess' => 'You …Run Code Online (Sandbox Code Playgroud) 我试图通过ftp上传文本文件,当我运行程序时,它清空我的文件,然后上传它.我不知道为什么......可能会覆盖或其他东西......这是我的代码:
这是在Main类
/* Create Object Instance */
ftp ftpClient = new ftp(@"ftp://sportcaffe.me", "sport***", "*****");
/* Upload a File */
ftpClient.upload("public_html/test.txt", @"C:\Users\Lazar\Desktop\test.txt");
Run Code Online (Sandbox Code Playgroud)
这里是ftp类的功能代码:
/* Upload File */
public void upload(string remoteFile, string localFile)
{
try
{
/* Create an FTP Request */
ftpRequest = (FtpWebRequest)FtpWebRequest.Create(host + "/" + remoteFile);
/* Log in to the FTP Server with the User Name and Password Provided */
ftpRequest.Credentials = new NetworkCredential(user, pass);
/* When in doubt, use these options */
ftpRequest.UseBinary = true;
ftpRequest.UsePassive …Run Code Online (Sandbox Code Playgroud)