how to stop php function execution?
i've a php script(call it file1) which i've scheduled as a cronjob...this script calls another php function in another php file(file2)......now what happens is for some unknown reason, this function exe开发者_运维技巧cutes twice (i.e. file1 calls function from file2)......
can anyone tell what could be the reason and what can be the solution...what i think is its some sort of OS/threads related issue but your expert opinion is more valueable...
thanks
Hard to be able to tell much without seeing your code (and possibly the cron config as well), but my guess would be that either you're calling the function twice in your program without realising it or else your cron config is causing the program to be run twice
You could try outputting the PID using the getmypid()
function at various places in your two bits of PHP code; this will help you determine which process invoked each call to the function, and will probably help you see which of the above scenarios (or something entirely different) is actually happening.
精彩评论