我有一个段落试图通过 bootstrap class 截断它text-truncate。在输出中我只得到一行。
<p class="text-truncate" style="max-width:300px;">
Resize the browser window to see that its width (max-width) will change at different breakpoints.Resize the browser window to see that its width (max-width) will change at different breakpoints
</p>
Run Code Online (Sandbox Code Playgroud)
获取输出
Resize the browser window to see that its wid...
Run Code Online (Sandbox Code Playgroud)
期待输出
Resize the browser window to see that its width (max-width)
will change at different breakpoints...
Run Code Online (Sandbox Code Playgroud)
在内联CSS中我尝试过-webkit-line-clamp: 2,得到相同的结果。如何使用 bootstrap 获得多行text-truncate?
我正在尝试在 cakephp 版本 4 中上传文件。
我正在关注这个文档
我在控制器中尝试过
if ($this->request->is('post')) {
$image = $this->request->getData('image');
$fileName = $image->getClientFilename();
$targetPath = WWW_ROOT.'img'.DS.$fileName;
$image->moveTo($targetPath);
$user = $this->Users->patchEntity($user, $this->request->getData()); //line 58
$user->image = $fileName;
$this->Users->save($user);
}
Run Code Online (Sandbox Code Playgroud)
图片上传工作正常,名称也保存在数据库中。但是当发生验证错误时,我得到
Warning (4096): Object of class Laminas\Diactoros\UploadedFile could not be converted to string [CORE\src\Database\Type\StringType.php, line 97]
Run Code Online (Sandbox Code Playgroud)
日志
Cake\Database\Type\StringType::marshal() - CORE\src\Database\Type\StringType.php, line 97
Cake\ORM\Marshaller::Cake\ORM\{closure}() - CORE\src\ORM\Marshaller.php, line 78
Cake\ORM\Marshaller::merge() - CORE\src\ORM\Marshaller.php, line 558
Cake\ORM\Table::patchEntity() - CORE\src\ORM\Table.php, line 2761
App\Controller\UsersController::add() - APP/Controller\UsersController.php, line 58
Cake\Controller\Controller::invokeAction() - CORE\src\Controller\Controller.php, line 524
Cake\Controller\ControllerFactory::invoke() …Run Code Online (Sandbox Code Playgroud)