Can cfmodule return values to caller's local scope?

前端 未结 1 1163
北荒
北荒 2021-01-05 23:39

Inside the cfm of the cfmodule, values are returned through the use of Caller scope. If I call a cfmodule inside a function in a CFC, Caller maps to the Variables scope of

1条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-05 23:41

    Yes, to all of the above. A demonstration:

    Testing.cfc:

    
    
        
    
        
    
            
    
            
            
    
            
    
            
    
        
    
    

    TestModule.cfm:

    
    
        
    
        
    
        
    
    
    

    Scribble.cfm:

    
    
    
    

    The dump shows you that you have access to the local variables within the function, as well as the variables scope of the entire CFC:

    struct
    
    CHECKTHESCOPEYO:  
        [function]
        Arguments: none 
        ReturnType: Struct 
        Roles:  
        Access: public 
        Output:   
        DisplayName:  
        Hint:  
        Description:  
    FROMMODULE: Set to the Variables scope
    INSTANCE:  
        [struct]
        FROMMODULE: Set to the Variables.instance variable
    THELOCAL:  
        [struct]
        FROMMODULE: Set to the LOCAL scope
    THIS:  
        [component Testing]
        Methods: 
            CHECKTHESCOPEYO
                [function]
                Arguments: none 
                ReturnType: Struct 
                Roles:  
                Access: public 
                Output:   
                DisplayName:  
                Hint:  
                Description:  
    

    0 讨论(0)
提交回复
热议问题