手机浏览 RSS 2.0 订阅 膘叔的简单人生 , 腾讯云RDS购买 | 超便宜的Vultr , 免费部署 N8N 的 Zeabur 注册 | 登陆
浏览模式: 标准 | 列表2025年12月的文章

Yii2 ErrorHandler的自定义

 不想多说这个,这一篇写的很好:Yii2组件分析:错误处理(ErrorHandle),我在这里只是想多说一两句:Yii::$app->getErrorHandler()->register(),这一条非常重要。

为什么多提这一句,是因为我在开发的过程中,用了不少的module,想为每一个module都单独设置一个errorHandler,所以特别的在module的init里加入了:Yii::$app->setComponents(['errorHandler'=>['class'=>'CustomErrorHandler']]);然而并不起作用,因为就少了那一句:Yii::$app->getErrorHandler()->register();

原因就是上文链接中提到的。Yii2在register方法里对输出做了自定义的处理,如果你不做一次register,你所使用的,将一直是配置文件中所配置的那个ErrorHandler。

这也就说明了,Yii::$app->setComponents()这个方法,还是要根据实际 情况来的。不是说临时改点变量,就可以直接用的。慎重

symlink-hook: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

出现如标题错误的最大可能原因是。。。

你当前所在的目录被改名或者被删除了。。,尝试cd /回到根目录下再处理

Tags: linux, getcwd

tinymce 5 的dialog不再支持iframe了

 尝试整个vue+tinymce的时候遇到点问题(之前说过,本来是用quillJS的。但如果要发表的内容支持那些微信编辑器里复制过来的内容。quill自己定义过的一些虚拟DOM就不支持了)

希望是美好的,实现起来是麻烦的,最后我放弃所有的选项,改用弹框iframe的形式。然而,问题就这么来了,tinymce5的dialog居然不支持iframe了。比如你看这个:https://github.com/tinymce/tinymce/issues/4786,官方直接说不支持了。NND

不过有人提示说,可以利用htmlpanel,直接在htmlpanel的html标签里,用<iframe。。。然后我试了一下。。居然真的OK

好吧,直接参考 这个了!https://github.com/tinymce/tinymce/issues/4786#issuecomment-463827289

JS文件:

JavaScript代码
  1. function FileManager(callback, value, meta) {  
  2.         var windowManagerURL = "/FilManage";// filemanager path  
  3.    
  4.         var windowManagerCSS = '<style type="text/css">' +  
  5.             '.tox-dialog {max-width: 100%!important; width:97.5%!important; overflow: hidden; height:95%!important; border-radius:0.25em;}' +  
  6.             '.tox-dialog__header{ display:none!important; }' +// for custom header in filemanage  
  7.             '.tox-dialog__footer { display: none!important; }' +// for custom footer in filemanage  
  8.             '.tox-dialog__body { padding: 0!important; }' +  
  9.             '.tox-dialog__body-content > div { height: 100%; overflow:hidden}' +   
  10.             '</style > ';  
  11.         window.tinymceCallBackURL = '';  
  12.         window.tinymceWindowManager = tinymce.activeEditor.windowManager;  
  13.         tinymceWindowManager.open({  
  14.             title: '',  
  15.             body: {  
  16.                 type: 'panel',  
  17.                 items: [{  
  18.                     type: 'htmlpanel',  
  19.                     html: windowManagerCSS+ '<iframe src="' + windowManagerURL + '"  frameborder="0" style="width:100%; height:100%"></iframe>'  
  20.                 }]  
  21.             },  
  22.             buttons: [] ,  
  23.             onClose: function () {  
  24.                 if (tinymceCallBackURL!='')  
  25.                     callback(tinymceCallBackURL, {}); //to set selected file path  
  26.             }   
  27.             
  28.         } );  
  29.     }  

iframe中:

JavaScript代码
  1. var windowManager = top != undefined && top.tinymceWindowManager != undefined ? top.tinymceWindowManager : '';  
  2.   
  3.   
  4.  if (windowManager != '') {  
  5.         if (top.tinymceCallBackURL != undefined)  
  6.             top.tinymceCallBackURL = path;  
  7.             windowManager.close();  
  8.     }  

 

Tags: tinymce

Error: Calling needs :cxx11 is disabled! There is no replacement.

brew 安装个软件,没装成功却开始报这个错了:

Already up-to-date.

Error: Calling needs :cxx11 is disabled! There is no replacement. 

Please report this to the chrisdeeming/legacyphp 

tap: /usr/local/Homebrew/Library/Taps/chrisdeeming/homebrew-legacyphp/Formula/php@7.0.rb:41

我晕。现在都7.2了,这个源还报错?看了下官网。原来这个源不再需要:needcxx11了。OK,官网说重新brew update一下就好了。

重新brew update。恢复正常

1、https://github.com/chrisdeeming/homebrew-legacyphp/pull/4

2、https://github.com/chrisdeeming/homebrew-legacyphp/issues/2

简易重启mac 下的mamp pro

 简单的弄一下。因为有时候要改配置,然后打开mamp,点击重启会耗时特别长。。。。所以简单的弄了一下

XML/HTML代码
  1. #!/bin/bash  
  2.   
  3. function start(){  
  4.     /Applications/MAMP/Library/bin/httpd -f "/Library/Application Support/appsolute/MAMP PRO/conf/httpd.conf" -k start  
  5. }  
  6.   
  7. function stop(){  
  8.     /Applications/MAMP/Library/bin/httpd -f "/Library/Application Support/appsolute/MAMP PRO/conf/httpd.conf" -k stop  
  9. }  
  10.   
  11. function restart(){  
  12.    (stop)  
  13.    (start)  
  14. }  
  15.   
  16. function status(){  
  17.     ps aux|grep httpd  
  18. }  
  19.   
  20. echo "which do you want to?input the number."  
  21. echo "1. start"  
  22. echo "2. stop"  
  23. echo "3. restart"  
  24. echo "4. status"  
  25. read num  
  26.   
  27. case "$num" in  
  28. [1] ) (start);;  
  29. [2] ) (stop);;  
  30. [3] ) (restart);;  
  31. [4] ) (status);;  
  32. *) echo "exit";;  
  33. esac  
其实没啥难度就是这么几行代码。连路径都没有定义变量。但一般情况下够用了,复制不成功的,可以直接打开://neatstudio.com/mamp.txt
 

Tags: mamp