我正在使用Visual Studio 2017社区版。我在制作C#项目时遇到困难,因为我无法使用System.IO.Stream。
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\NiceAction;
class NiceActionController extends Controller {
public function getHome() {
$actions = NiceAction::all();
return view ('home', ['actions' => $actions]);
}
public function getNiceAction ($action, $name = null) {
if ($name === null ) {
$name = 'you';
}
return view ('actions.nice', [
'action' => $action,
'name'=> $name
]);
}
public function postInsertNiceAction (Request $request) {
$this->validate($request, [
'action' => 'required',
'name' => 'required|alpha',
'niceness' => 'required|numeric'
]);
$action = new NiceAction();
$action->name = $request['name'];
$action->niceness = $request['niceness'];
$action->save();
$actions = NiceAction::all();
return view ('home', ['actions' => $actions]);
}
private function transformName($name){
$prefix = 'KING ';
return $prefix.strtoupper($name);
}
}
答案 0 :(得分:3)
命名空间实际上是System.IO 用System.IO替换System.IO.Stream Stream是一个类,而不是命名空间
答案 1 :(得分:2)