好吧我非常喜欢流明和laravel,我试图让这个api https://packagist.org/packages/codenexus/lumen-geoip在流明中工作,我通过作曲家安装它并且能够使用它并根据我在里面的时候给出的IP获取位置routes.php
但是当我在控制器中使用相同的代码时,它不会让我继续,因为$ app变量没有被定义。
这是在路线
内工作的代码Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim CompanyName As String
If Selection.Count = 1 Then
If Not Intersect(Target, Range("C1").EntireColumn) Is Nothing Then
'This code is triggered when any
'ONE cell in column C is selected
'Simply change "C1" to "B1" etc etc
'This MsgBox returns the selected cell
MsgBox Target.Address
'You'll probably need to collect some information
'in this section. You can then use this to affect
'the filters on sheet 2.
'Perhaps like this
CompanyName = Cells(Target.Row, 1).Value
MsgBox CompanyName
'This changes to "Sheet2"
Sheets("Sheet2").Activate
End If
End If
End Sub
我一直在读服务容器可以帮助我解决这个问题,但我感到迷茫...... 感谢您提供帮助的建议。
答案 0 :(得分:5)
crop_canvas = document.createElement('canvas');
crop_canvas.width = width;
crop_canvas.height = height;
crop_2d = crop_canvas.getContext('2d');
crop_2d.imageSmoothingEnabled = false;
crop_2d.drawImage(image_target, left, top, parseInt(width), parseInt(height), 0, 0, parseInt(width), parseInt(height));
this.href = crop_canvas.toDataURL('image/png');
变量在控制器中不可用,但您可以在代码中的任何位置使用$app
方法来访问应用程序对象。
所以,在你的控制器中试试这个:
app()